diff --git a/README.md b/README.md index d1bb23c..7bb0cee 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,9 @@ The following messages are handled: magnetise COR Move all the fences toward the given corner. + send_to_monitor MONITOR_NAME + Send the focused window to the given monitor. + send_to DESKTOP_NAME Send the focused window to the given desktop. diff --git a/messages.c b/messages.c index eaecad2..6395a23 100644 --- a/messages.c +++ b/messages.c @@ -129,11 +129,10 @@ void process_message(char *msg, char *rsp) } else if (strcmp(cmd, "send_to_monitor") == 0) { char *name = strtok(NULL, TOKEN_SEP); if (name != NULL) { - desktop_location_t loc; - if (locate_desktop(name, &loc)) { - transfer_node(mon, mon->desk, loc.monitor, loc.desktop, mon->desk->focus); - if (mon != loc.monitor && loc.monitor->desk == loc.desktop) - arrange(loc.monitor, loc.desktop); + monitor_t *m = find_monitor(name); + if (m != NULL && m != mon) { + transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus); + arrange(m, m->desk); } } } else if (strcmp(cmd, "send_to") == 0) {