]> git.lizzy.rs Git - bspwm.git/commitdiff
The 'layout' message handles desktop names
authorBastien Dejean <nihilhill@gmail.com>
Mon, 5 Nov 2012 11:37:43 +0000 (12:37 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Mon, 5 Nov 2012 11:37:43 +0000 (12:37 +0100)
README.md
bspwm.1
messages.c

index 5deb0626ca4748c0be0d81a5ad478bd389107aab..b40dac488c011b3b6b61325d60feb2b1c8745749 100644 (file)
--- a/README.md
+++ b/README.md
@@ -173,8 +173,8 @@ The following messages are handled:
     cycle_desktop next|prev [--skip-free|--skip-occupied]
         Select the next or previous desktop.
 
-    layout monocle|tiled
-        Set the layout of the current desktop.
+    layout monocle|tiled [DESKTOP_NAME ...]
+        Set the layout of the given desktops (current if none given).
 
     cycle_layout
         Cycle the layout of the current desktop.
diff --git a/bspwm.1 b/bspwm.1
index fc49fefab1eb753dd9ec2568ab85919171ee60e3..5927844ff506e87fad161a83a410f03f0a2982a2 100644 (file)
--- a/bspwm.1
+++ b/bspwm.1
@@ -202,8 +202,8 @@ Select the next or previous monitor.
 .BI cycle_desktop " next|prev [--skip-free|--skip-occupied]"
 Select the next or previous desktop.
 .TP
-.BI layout " monocle|tiled"
-Set the layout of the current desktop.
+.BI layout " monocle|tiled [DESKTOP_NAME ...]"
+Set the layout of the given desktops (current if none given).
 .TP
 .BI cycle_layout
 Cycle the layout of the current desktop.
index d1288076f8b51ade4ec214d0a6cf423f71e1a5d2..3e445c8c89fdfa24fb8c94209225bca09c3b6a02 100644 (file)
@@ -61,9 +61,18 @@ void process_message(char *msg, char *rsp)
     } else if (strcmp(cmd, "layout") == 0) {
         char *lyt = strtok(NULL, TOKEN_SEP);
         if (lyt != NULL) {
-            layout_t l;
-            if (parse_layout(lyt, &l)) {
-                mon->desk->layout = l;
+            layout_t y;
+            if (parse_layout(lyt, &y)) {
+                char *name = strtok(NULL, TOKEN_SEP);
+                if (name == NULL) {
+                    mon->desk->layout = y;
+                } else {
+                    desktop_location_t loc;
+                    do {
+                        if (locate_desktop(name, &loc))
+                            loc.desktop->layout = y;
+                    } while ((name = strtok(NULL, TOKEN_SEP)) != NULL);
+                }
             }
         }
     } else if (strcmp(cmd, "cycle_layout") == 0) {