]> git.lizzy.rs Git - bspwm.git/commitdiff
Add `--follow` option to `send_desktop_to`
authorBastien Dejean <nihilhill@gmail.com>
Tue, 4 Jun 2013 11:45:18 +0000 (13:45 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 4 Jun 2013 11:45:18 +0000 (13:45 +0200)
README.md
bspwm.1
messages.c

index 8727d4c5df91afa9c3bdffe98355564699864c61..96a9b124f434ddf1b1e29d22d6726fe7053a7e7f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -167,7 +167,7 @@ The following messages are handled:
 
 - `remove_desktop DESKTOP_NAME ...` — Remove the given desktops.
 
-- `send_desktop_to MONITOR_NAME` — Send the current desktop to the given monitor.
+- `send_desktop_to MONITOR_NAME [--follow]` — Send the current desktop to the given monitor.
 
 - `cycle_monitor next|prev` — Select the next or previous monitor.
 
diff --git a/bspwm.1 b/bspwm.1
index 07f0bdf5bdbf8ee3898bf8300cbe9b9ad109f7f1..a99894a63d5020d6a453d624cfe16b85f8f415fd 100644 (file)
--- a/bspwm.1
+++ b/bspwm.1
@@ -230,7 +230,7 @@ Rename the desktop named CURRENT_NAME to NEW_NAME.
 .BI remove_desktop " DESKTOP_NAME ..."
 Remove the given desktops.
 .TP
-.BI send_desktop_to " MONITOR_NAME"
+.BI send_desktop_to " MONITOR_NAME [--follow]"
 Send the current desktop to the given monitor.
 .TP
 .BI cycle_monitor " next|prev"
index 7bdc61c79a2a55fa2780be70977d7340afa212f4..1a9a61aaef9a5563048c601f6e1a0fee04973bda 100644 (file)
@@ -441,11 +441,17 @@ void process_message(char *msg, char *rsp)
         char *name = strtok(NULL, TOK_SEP);
         if (name != NULL) {
             monitor_t *m = find_monitor(name);
-            if (m != NULL) {
-                desktop_hide(mon->desk);
-                transfer_desktop(mon, m, mon->desk);
+            if (m != NULL && m != mon) {
+                desktop_t *d = mon->desk;
+                desktop_hide(d);
+                transfer_desktop(mon, m, d);
                 desktop_show(mon->desk);
-                update_current();
+                char *opt = strtok(NULL, TOK_SEP);
+                send_option_t o;
+                if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
+                    focus_node(m, d, d->focus);
+                else
+                    update_current();
             }
         }
         return;