]> git.lizzy.rs Git - bspwm.git/commitdiff
Add wm command: --reorder-monitors
authorBastien Dejean <nihilhill@gmail.com>
Sun, 30 Jul 2017 12:48:03 +0000 (14:48 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 30 Jul 2017 12:48:03 +0000 (14:48 +0200)
doc/bspwm.1
doc/bspwm.1.asciidoc
src/messages.c

index bb645bc2a51e94e35efabd2bc173a2f99eaa5730..ec4d5726bcee290b68ff7691abccc54c94de7708 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 07/25/2017
+.\"      Date: 07/30/2017
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.3-14-gefec936
+.\"    Source: Bspwm 0.9.3-16-ga4c5b29
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "07/25/2017" "Bspwm 0\&.9\&.3\-14\-gefec936" "Bspwm Manual"
+.TH "BSPWM" "1" "07/30/2017" "Bspwm 0\&.9\&.3\-16\-ga4c5b29" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -900,6 +900,11 @@ Load a world state from the given file\&.
 Add a monitor for the given name and rectangle\&.
 .RE
 .PP
+\fB\-O\fR, \fB\-\-reorder\-monitors\fR <name>\&...
+.RS 4
+Reorder the list of monitors to match the given order\&.
+.RE
+.PP
 \fB\-o\fR, \fB\-\-adopt\-orphans\fR
 .RS 4
 Manage all the unmanaged windows remaining from a previous session\&.
index bcf05ff1e71fca37137afd99fffa92bceba8a49e..3d4115293cd2f91a6e66973dda2b3e3f596c7911 100644 (file)
@@ -531,6 +531,9 @@ Commands
 *-a*, *--add-monitor* <name> WxH+X+Y::
        Add a monitor for the given name and rectangle.
 
+*-O*, *--reorder-monitors* <name>...::
+       Reorder the list of monitors to match the given order.
+
 *-o*, *--adopt-orphans*::
        Manage all the unmanaged windows remaining from a previous session.
 
index 5c2af44f0286fdb4e478125b36f08e735b06a923..e987e9b5d0c73cc862de02d134d8915391b35122 100644 (file)
@@ -1190,6 +1190,25 @@ void cmd_wm(char **args, int num, FILE *rsp)
                                fail(rsp, "wm %s: Invalid argument: '%s'.\n", *(args - 1), *args);
                                break;
                        }
+               } else if (streq("-O", *args) || streq("--reorder-monitors", *args)) {
+                       num--, args++;
+                       if (num < 1) {
+                               fail(rsp, "wm %s: Not enough arguments.\n", *(args - 1));
+                               return;
+                       }
+                       monitor_t *m = mon_head;
+                       while (m != NULL && num > 0) {
+                               monitor_t *next = m->next;
+                               coordinates_t dst;
+                               if (locate_monitor(*args, &dst)) {
+                                       swap_monitors(m, dst.monitor);
+                                       if (next == dst.monitor) {
+                                               next = m;
+                                       }
+                               }
+                               m = next;
+                               num--, args++;
+                       }
                } else if (streq("-o", *args) || streq("--adopt-orphans", *args)) {
                        adopt_orphans();
                } else if (streq("-g", *args) || streq("--get-status", *args)) {