diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-02-05 21:19:55 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-02-05 21:19:55 -0800 |
commit | 0c9563656ce00b0ad2608ec9b81301080be163dc (patch) | |
tree | b224003e2f4a465ebf2dc91e7a70c24c39918d80 | |
parent | ab2bc6f761682b5a0de50a580b5d3ae8d7649098 (diff) |
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.
-rw-r--r-- | src/key.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); } |