Skip to content

Commit

Permalink
Fully removed modes from howm
Browse files Browse the repository at this point in the history
  • Loading branch information
HarveyHunt committed Dec 9, 2015
1 parent 0c53eb0 commit 2115aa8
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 69 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ The above command will cut 2 clients and place them onto the delete register sta

A good primer on modes is available [here](http://vimdoc.sourceforge.net/htmldoc/intro.html#vim-modes-intro).

**Note**: Modes used to be implemented in howm itself, but are now in the sxhkd
configuration file.

In howm, modes are used to allow the same keys to be bound to multiple functions. Modes also help to logically separate what needs to be done to a window. The available modes are as follows:

* **Normal**: This mode is the one that you will spend most of your time in. It is used for executing commands and most of the operators are designed to work in this mode. This mode behaves similarly to how other WMs behave, but without focusing or dealing with floating windows.
Expand All @@ -239,26 +242,26 @@ In howm, modes are used to allow the same keys to be bound to multiple functions

##Parsing Output

When debug mode is disabled, howm outputs information about its current state and the current workspace whenever something changes (such as adding a new window or changing mode). When debug mode is enabled, information is outputted for each workspace (placed on a new line).
When debug mode is disabled, howm outputs information about its current state and the current workspace whenever something changes (such as adding a new window). When debug mode is enabled, information is outputted for each workspace (placed on a new line).

The format for the output is as follows:

```
Mode:Layout:Workspace:State:NumberofClients
Layout:Workspace:State:NumberofClients
```

An example output can be seen below:

```
0:2:1:0:1
2:1:0:1
```

The information outputted at the same time as the example above, but with debugging mode turned on is shown below:

```
0:2:1:0:1
0:2:2:0:0
0:2:3:0:0
0:2:4:0:0
0:2:5:0:0
2:1:0:1
2:2:0:0
2:3:0:0
2:4:0:0
2:5:0:0
```
7 changes: 1 addition & 6 deletions examples/bar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ ws=("term" "vim" "www" "chat" "media")

lay=("" "" "" "")

mbg=("#333333" "#5F5F87" "#AFD7AF")
mfg=("#DDDDDD" "#333333" "#333333")

bg="#333333"

while read -t 10 -r howmout || true; do
if [[ $howmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
unset r
IFS=':' read -r m l w s c <<< "$howmout"
r+='^fg('"${mfg[$m]}"')'
r+='^bg('"${mbg[$m]}"')'
IFS=':' read -r l w s c <<< "$howmout"
r+=" ${lay[$l]} | "
r+="${ws[$w - 1]}"
r="${r%::*}"
Expand Down
2 changes: 0 additions & 2 deletions examples/sxhkdrc_floating
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ super + {y, u, i, space, b, n, m}
cottage -f teleport_client {0, 1, 2, 3, 4, 5, 6}

super + Escape
cottage -f change_mode 0; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_normal ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd

super + f
cottage -f change_mode 1; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_focus ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd
Expand Down
2 changes: 0 additions & 2 deletions examples/sxhkdrc_focus
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ super + shift + {k, j}
cottage -f {move_current_up, move_current_down}

super + Escape
cottage -f change_mode 0; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_normal ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd
Expand All @@ -29,7 +28,6 @@ super + shift + {1, 2, 3, 4, 5}
cottage -f current_to_ws {1, 2, 3, 4, 5}

super + shift + f
cottage -f change_mode 2; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_floating ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd
Expand Down
2 changes: 0 additions & 2 deletions examples/sxhkdrc_normal
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ super + shift + n
cottage -f previous_layout

super + f
cottage -f change_mode 1; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_focus ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd

super + shift + f
cottage -f change_mode 2; \
rm ~/.config/sxhkd/sxhkdrc; \
ln -s ~/.config/sxhkd/sxhkdrc_floating ~/.config/sxhkd/sxhkdrc; \
pkill -USR1 -x sxhkd
Expand Down
9 changes: 4 additions & 5 deletions src/howm.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ uint32_t border_focus = 0;
uint32_t border_unfocus = 0;
uint32_t border_prev_focus = 0;
uint32_t border_urgent = 0;
unsigned int cur_mode = 0;
uint16_t screen_height = 0;
uint16_t screen_width = 0;
int cur_state = OPERATOR_STATE;
Expand Down Expand Up @@ -236,14 +235,14 @@ void howm_info(void)
unsigned int w = 0;
#if DEBUG_ENABLE
for (w = 1; w <= WORKSPACES; w++) {
fprintf(stdout, "%u:%d:%u:%d:%u\n", cur_mode,
wss[w].layout, w, cur_state, wss[w].client_cnt);
fprintf(stdout, "%d:%u:%d:%u\n", wss[w].layout, w,
cur_state, wss[w].client_cnt);
}
fflush(stdout);
#else
UNUSED(w);
fprintf(stdout, "%u:%d:%d:%d:%u\n", cur_mode,
wss[cw].layout, cw, cur_state, wss[cw].client_cnt);
fprintf(stdout, "%d:%d:%d:%u\n", wss[cw].layout, cw,
cur_state, wss[cw].client_cnt);
fflush(stdout);
#endif
}
Expand Down
1 change: 0 additions & 1 deletion src/howm.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ extern int last_ws;
extern int previous_layout;
extern int cw;
extern xcb_connection_t *dpy;
extern unsigned int cur_mode;
extern uint16_t screen_height;
extern uint16_t screen_width;
extern int cur_state;
Expand Down
3 changes: 0 additions & 3 deletions src/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "howm.h"
#include "ipc.h"
#include "layout.h"
#include "mode.h"
#include "op.h"
#include "scratchpad.h"
#include "types.h"
Expand Down Expand Up @@ -159,8 +158,6 @@ static int ipc_process_function(char **args)
CALL_INT(resize_master, *(args + 1), -100, 100);
} else if (strncmp(*args, "change_ws", strlen("change_ws")) == 0) {
CALL_INT(change_ws, *(args + 1), 1, WORKSPACES);
} else if (strncmp(*args, "change_mode", strlen("change_mode")) == 0) {
CALL_INT(change_mode, *(args + 1), NORMAL, END_MODES - 1);
} else if (strncmp(*args, "change_layout", strlen("change_layout")) == 0) {
CALL_INT(change_layout, *(args + 1), ZOOM, END_LAYOUT - 1);
} else if (strncmp(*args, "count", strlen("count")) == 0) {
Expand Down
22 changes: 0 additions & 22 deletions src/mode.c

This file was deleted.

18 changes: 0 additions & 18 deletions src/mode.h

This file was deleted.

0 comments on commit 2115aa8

Please sign in to comment.