diff --git a/include/config.h b/include/config.h index c4fe6b08..f05de324 100644 --- a/include/config.h +++ b/include/config.h @@ -171,7 +171,7 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch); * Switches the key bindings to the given mode, if the mode exists * */ -void switch_mode(xcb_connection_t *conn, const char *new_mode); +void switch_mode(const char *new_mode); /** * Returns a pointer to the Binding with the specified modifiers and keycode diff --git a/src/cmdparse.l b/src/cmdparse.l index bc83b026..641265e6 100644 --- a/src/cmdparse.l +++ b/src/cmdparse.l @@ -112,7 +112,7 @@ border { return TOK_BORDER; } normal { return TOK_NORMAL; } none { return TOK_NONE; } 1pixel { return TOK_1PIXEL; } -mode { return TOK_MODE; } +mode { BEGIN(WANT_QSTRING); return TOK_MODE; } tiling { return TOK_TILING; } floating { return TOK_FLOATING; } toggle { return TOK_TOGGLE; } diff --git a/src/cmdparse.y b/src/cmdparse.y index a540efed..f86bead9 100644 --- a/src/cmdparse.y +++ b/src/cmdparse.y @@ -352,6 +352,7 @@ operation: | mark | resize | nop + | mode ; exec: @@ -784,3 +785,10 @@ direction: | TOK_LEFT { $$ = TOK_LEFT; } | TOK_RIGHT { $$ = TOK_RIGHT; } ; + +mode: + TOK_MODE STR + { + switch_mode($2); + } + ; diff --git a/src/config.c b/src/config.c index 572b4ab9..98b40dc4 100644 --- a/src/config.c +++ b/src/config.c @@ -150,7 +150,7 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch) { * Switches the key bindings to the given mode, if the mode exists * */ -void switch_mode(xcb_connection_t *conn, const char *new_mode) { +void switch_mode(const char *new_mode) { struct Mode *mode; LOG("Switching to mode %s\n", new_mode);