]> git.sur5r.net Git - i3/i3/commitdiff
Implement the possibility to set a workspace open clients automatically in floating...
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 11:20:10 +0000 (13:20 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 11:20:10 +0000 (13:20 +0200)
Use "wwt" (with workspace: toggle floating) in your configuration file

include/data.h
src/commands.c
src/manage.c

index 1f4e1d0fd5205d0a788ba96cede1089249eb4c8b..a31b6982572d9634b560644647a03b6cbcffef45 100644 (file)
@@ -161,6 +161,9 @@ struct Workspace {
         int current_row;
         int current_col;
 
+        /* Should clients on this workspace be automatically floating? */
+        bool auto_float;
+
         Client *fullscreen_client;
 
         /* The focus stack contains the clients in the correct order of focus so that
index 3300d1f890e43ec3bfa7315a0ce2a35cb9bf4581..d809c81a7c9beb8863c8c5fe3cdb41240d9af85a 100644 (file)
@@ -854,8 +854,31 @@ void parse_command(xcb_connection_t *conn, const char *command) {
                 return;
         }
 
+        enum { WITH_WINDOW, WITH_CONTAINER, WITH_WORKSPACE } with = WITH_WINDOW;
+
+        /* Is it a <with>? */
+        if (command[0] == 'w') {
+                command++;
+                /* TODO: implement */
+                if (command[0] == 'c') {
+                        with = WITH_CONTAINER;
+                        command++;
+                } else if (command[0] == 'w') {
+                        with = WITH_WORKSPACE;
+                        command++;
+                } else {
+                        LOG("not yet implemented.\n");
+                        return;
+                }
+        }
+
         /* Is it 't' for toggle tiling/floating? */
         if (command[0] == 't') {
+                if (with == WITH_WORKSPACE) {
+                        c_ws->auto_float = !c_ws->auto_float;
+                        LOG("autofloat is now %d\n", c_ws->auto_float);
+                        return;
+                }
                 if (last_focused == NULL) {
                         LOG("Cannot toggle tiling/floating: workspace empty\n");
                         return;
@@ -873,21 +896,6 @@ void parse_command(xcb_connection_t *conn, const char *command) {
                 return;
         }
 
-        enum { WITH_WINDOW, WITH_CONTAINER } with = WITH_WINDOW;
-
-        /* Is it a <with>? */
-        if (command[0] == 'w') {
-                command++;
-                /* TODO: implement */
-                if (command[0] == 'c') {
-                        with = WITH_CONTAINER;
-                        command++;
-                } else {
-                        LOG("not yet implemented.\n");
-                        return;
-                }
-        }
-
         /* It’s a normal <cmd> */
         char *rest = NULL;
         enum { ACTION_FOCUS, ACTION_MOVE, ACTION_SNAP } action = ACTION_FOCUS;
index f4edc055e1e0d11e5b0cd3ee270c511aa0e1aaf2..aebfe54637697b03ef2753dabe67393d27b06160 100644 (file)
@@ -265,10 +265,15 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                                    atom[i] == atoms[_NET_WM_WINDOW_TYPE_SPLASH]) {
                                 /* Set the dialog window to automatically floating, will be used below */
                                 new->floating = FLOATING_AUTO_ON;
-                                LOG("dialog window, automatically floating\n");
+                                LOG("dialog/utility/toolbar/splash window, automatically floating\n");
                         }
         }
 
+        if (new->workspace->auto_float) {
+                new->floating = FLOATING_AUTO_ON;
+                LOG("workspace is in autofloat mode, setting floating\n");
+        }
+
         if (new->dock) {
                 /* Get _NET_WM_STRUT_PARTIAL to determine the client’s requested height */
                 uint32_t *strut;