]> git.sur5r.net Git - i3/i3/commitdiff
Implement the special workspace ~ for assignments, which will set clients floating...
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 18:20:00 +0000 (20:20 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 19 Jun 2009 18:20:00 +0000 (20:20 +0200)
docs/userguide
include/data.h
src/config.c
src/manage.c

index 0c7f9a07250e10678d41e180571c81b93b6d668b..4ba97ee90aa07c97755c247a52ebc995d999c9af 100644 (file)
@@ -237,6 +237,9 @@ i3 will get the title as soon as the application maps the window (mapping means
 actually displaying it on the screen), you’d need to have to match on Firefox
 in this case.
 
+You can use the special workspace +~+ to specify that matching clients should
+be put into floating mode.
+
 *Syntax*:
 ----------------------------------------------------
 assign ["]window class[/window title]["] [→] workspace
@@ -248,6 +251,7 @@ assign urxvt 2
 assign urxvt → 2
 assign "urxvt" → 2
 assign "urxvt/VIM" → 3
+assign "gecko" → ~
 ----------------------
 
 === Automatically starting applications on startup
index 87dd49953fac816e95b85a0f45ef792946727294..b468c1f7092aeac0d9bf8740e144c763ce2cdf9f 100644 (file)
@@ -223,6 +223,9 @@ struct Autostart {
  */
 struct Assignment {
         char *windowclass_title;
+        /* floating is true if this was an assignment to the special workspace "~".
+         * Matching clients will be put into floating mode automatically. */
+        bool floating;
         int workspace;
         TAILQ_ENTRY(Assignment) assignments;
 };
index 5d6312edfb3c69ac57414c745b6dcfaad428f10d..197fd4e1f08335f4171a4bb456080ba09973f7a2 100644 (file)
@@ -241,14 +241,16 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
                                 die("Malformed assignment, couldn't find target\n");
                         target++;
 
-                        if (atoi(target) < 1 || atoi(target) > 10)
+                        if (*target != '~' && (atoi(target) < 1 || atoi(target) > 10))
                                 die("Malformed assignment, invalid workspace number\n");
 
                         LOG("assignment parsed: \"%s\" to \"%s\"\n", class_title, target);
 
-                        struct Assignment *new = smalloc(sizeof(struct Assignment));
+                        struct Assignment *new = scalloc(sizeof(struct Assignment));
                         new->windowclass_title = class_title;
-                        new->workspace = atoi(target);
+                        if (*target == '~')
+                                new->floating = true;
+                        else new->workspace = atoi(target);
                         TAILQ_INSERT_TAIL(&assignments, new, assignments);
                         continue;
                 }
index aebfe54637697b03ef2753dabe67393d27b06160..dfbe12ccd5abd1bd5d4e7764d43e242697918d49 100644 (file)
@@ -315,6 +315,12 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                         if (get_matching_client(conn, assign->windowclass_title, new) == NULL)
                                 continue;
 
+                        if (assign->floating) {
+                                new->floating = FLOATING_AUTO_ON;
+                                LOG("Assignment matches, putting client into floating mode\n");
+                                break;
+                        }
+
                         LOG("Assignment \"%s\" matches, so putting it on workspace %d\n",
                             assign->windowclass_title, assign->workspace);