From 0c9563656ce00b0ad2608ec9b81301080be163dc Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 5 Feb 2022 21:19:55 -0800 Subject: key: create desktop on isolated window mru migrate When the context has a lone desktop, attempting a migrate to the next MRU desktop does nothing. This change treats the situation exceptionally and creates a new desktop in the context for receiving the migrated window, as it's likely the desired result. --- src/key.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/key.c b/src/key.c index da1a22b..34af4f7 100644 --- a/src/key.c +++ b/src/key.c @@ -228,9 +228,13 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress) } else if (send_it) { /* "send" the focused window to a new desktop in the current context, kind of an alias of send_it+XK_v */ if (vwin) vwm_win_send(vwm, vwin, vwm_desktop_mru(vwm, vwm_desktop_create(vwm, vwin->desktop->context))); - } else if (keypress->state & ShiftMask) { /* migrate the focused window with the desktop focus to the most recently used desktop */ - if (vwin) + } else if (keypress->state & ShiftMask) { /* migrate the focused window with the desktop focus to the most recently used desktop, creating one if none exists for convenience */ + if (vwin) { + if (next_desktop == vwm->focused_desktop) + next_desktop = vwm_desktop_create(vwm, vwin->desktop->context); + vwm_win_migrate(vwm, vwin, next_desktop); + } } else { vwm_desktop_focus(vwm, next_desktop); } -- cgit v1.2.3