]> git.sur5r.net Git - i3/i3/commitdiff
Re-implement the 'mode' command
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 10 Jun 2011 00:38:07 +0000 (02:38 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 10 Jun 2011 00:38:07 +0000 (02:38 +0200)
include/config.h
src/cmdparse.l
src/cmdparse.y
src/config.c

index c4fe6b0848d801f38b7c47701ad9303410d1282b..f05de3243aa3b9cde8b2c7bd5b8f54b712a734b7 100644 (file)
@@ -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
index bc83b026bbfaeba1b713378fa1b8b2344b4a5d0e..641265e60444d78a0e22127e54df257467b8b63d 100644 (file)
@@ -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; }
index a540efed04099ebac6455a808af8b4cea7c77725..f86bead94c481c373c7c773056cec62f7084d7ef 100644 (file)
@@ -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);
+    }
+    ;
index 572b4ab9f93075a73a22e9886fa80f94b24c5eea..98b40dc49d8ebeb674c2b26193a3cfc2ea752ae0 100644 (file)
@@ -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);