From 2115aa873f4c7d3ed785de73393dbbe0e461517f Mon Sep 17 00:00:00 2001 From: Harvey Hunt Date: Tue, 1 Dec 2015 20:42:19 +0000 Subject: [PATCH] Fully removed modes from howm --- README.md | 19 +++++++++++-------- examples/bar.sh | 7 +------ examples/sxhkdrc_floating | 2 -- examples/sxhkdrc_focus | 2 -- examples/sxhkdrc_normal | 2 -- src/howm.c | 9 ++++----- src/howm.h | 1 - src/ipc.c | 3 --- src/mode.c | 22 ---------------------- src/mode.h | 18 ------------------ 10 files changed, 16 insertions(+), 69 deletions(-) delete mode 100644 src/mode.c delete mode 100644 src/mode.h diff --git a/README.md b/README.md index 44a590e..86dbbaa 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 ``` diff --git a/examples/bar.sh b/examples/bar.sh index 42aa476..3f9b481 100755 --- a/examples/bar.sh +++ b/examples/bar.sh @@ -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%::*}" diff --git a/examples/sxhkdrc_floating b/examples/sxhkdrc_floating index f5a6fc6..ff26d0b 100644 --- a/examples/sxhkdrc_floating +++ b/examples/sxhkdrc_floating @@ -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 diff --git a/examples/sxhkdrc_focus b/examples/sxhkdrc_focus index 2a1cac5..4f8ec26 100644 --- a/examples/sxhkdrc_focus +++ b/examples/sxhkdrc_focus @@ -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 @@ -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 diff --git a/examples/sxhkdrc_normal b/examples/sxhkdrc_normal index b0c66f2..552061c 100644 --- a/examples/sxhkdrc_normal +++ b/examples/sxhkdrc_normal @@ -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 diff --git a/src/howm.c b/src/howm.c index 6f29468..50c7376 100644 --- a/src/howm.c +++ b/src/howm.c @@ -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; @@ -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 } diff --git a/src/howm.h b/src/howm.h index 3f19dcc..b856d32 100644 --- a/src/howm.h +++ b/src/howm.h @@ -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; diff --git a/src/ipc.c b/src/ipc.c index 2045443..762c1bd 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -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" @@ -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) { diff --git a/src/mode.c b/src/mode.c deleted file mode 100644 index ce433c1..0000000 --- a/src/mode.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "helper.h" -#include "howm.h" -#include "mode.h" - -/** - * @brief Change the mode of howm. - * - * Modes should be thought of in the same way as they are in vi. Different - * modes mean keypresses cause different actions. - * - * @param mode The mode to be selected. - * - * @ingroup commands - */ -void change_mode(const unsigned int mode) -{ - if (mode >= END_MODES || mode == cur_mode) - return; - cur_mode = mode; - log_info("Changing to mode %u", cur_mode); - howm_info(); -} diff --git a/src/mode.h b/src/mode.h deleted file mode 100644 index b6ecb22..0000000 --- a/src/mode.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MODE_H -#define MODE_H - -/** - * @file mode.h - * - * @author Harvey Hunt - * - * @date 2015 - * - * @brief howm - */ - -enum modes { NORMAL, FOCUS, FLOATING, END_MODES }; - -void change_mode(const unsigned int mode); - -#endif