]> git.sur5r.net Git - i3/i3/commitdiff
Added focus_follows_mouse config option
authorKim Silkebækken (lokaltog) <kim.silkebaekken@gmail.com>
Tue, 26 Jan 2010 11:10:48 +0000 (12:10 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 29 Jan 2010 20:58:50 +0000 (21:58 +0100)
include/config.h
src/cfgparse.l
src/cfgparse.y
src/handlers.c

index 3080c5c37e05aa85b8af5b5980253b6b2c11fb97..b81c3492231806955c48e507949e66c3cd399329 100644 (file)
@@ -77,6 +77,8 @@ struct Config {
         int container_stack_limit;
         int container_stack_limit_value;
 
+        bool focus_follows_mouse;
+
         const char *default_border;
 
         /** The modifier which needs to be pressed in combination with your mouse
index ac862a2e93382ffaf7963ae7849fcdbfff6be0c9..ce912549568819b4eb38e919c8a3bc33539d25cd 100644 (file)
@@ -44,6 +44,7 @@ ipc-socket                      { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
 ipc_socket                      { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
 new_container                   { return TOKNEWCONTAINER; }
 new_window                      { return TOKNEWWINDOW; }
+focus_follows_mouse             { return TOKFOCUSFOLLOWSMOUSE; }
 default                         { yylval.number = MODE_DEFAULT; return TOKCONTAINERMODE; }
 stacking                        { yylval.number = MODE_STACK; return TOKCONTAINERMODE; }
 tabbed                          { yylval.number = MODE_TABBED; return TOKCONTAINERMODE; }
index 030c51af69582a1c05545ad98ca532d9860a6f28..cc1b2d16a00b7f0f3146993a71f9b680f908011d 100644 (file)
@@ -197,6 +197,7 @@ void parse_file(const char *f) {
 %token TOKMODE
 %token TOKNEWCONTAINER
 %token TOKNEWWINDOW
+%token TOKFOCUSFOLLOWSMOUSE
 %token TOKCONTAINERMODE
 %token TOKSTACKLIMIT
 
@@ -213,6 +214,7 @@ line:
         | floating_modifier
         | new_container
         | new_window
+        | focus_follows_mouse
         | workspace
         | assign
         | ipcsocket
@@ -379,6 +381,13 @@ new_window:
         }
         ;
 
+focus_follows_mouse:
+        TOKFOCUSFOLLOWSMOUSE WHITESPACE NUMBER
+        {
+                config.focus_follows_mouse = ($<number>3 == 0 ? 0 : 1);
+        }
+        ;
+
 workspace:
         TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen optional_workspace_name
         {
index c9f953451f058ad26763356430344f898e544b91..a0097bcd92baf038e6a9f7dc557f4d9ba67a2173 100644 (file)
@@ -236,7 +236,8 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_
                 return 1;
         }
 
-        set_focus(conn, client, false);
+        if (config.focus_follows_mouse)
+                set_focus(conn, client, false);
 
         return 1;
 }