From 98d6a06b8050082c2f45ebaf027c2bf324d4dc8a Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 15 Feb 2025 14:50:08 -0800 Subject: window: support migrating non-autoconf windows by screen This is better than nothing, but the screens should be cycled in MRU order like everything else. The way things are as-is with the bare bones RandR integration, screens are just an array of the underlying X type. There isn't really a vwm-native type representing the screen, it's just an alias for the X type. So there should be a refactor surrounding screens and a switch to MRU order. Anyhow, even though it's not ideal, I've been using this daily on a multihead setup and it's a marked usability improvement. --- src/key.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/key.c') diff --git a/src/key.c b/src/key.c index 2c2a3fd..7246510 100644 --- a/src/key.c +++ b/src/key.c @@ -215,20 +215,7 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress) */ if (vwin) { - if (send_it) { - /* "send" the focused window to the next screen */ - VWM_TRACE("send window to screen not implemented yet"); - /* TODO: this is identical to "migrate" below, but needs to focus - * the next window within the origin screen if there is one. - * It's unclear to me what should happen when you "send" the only - * window in the current scren to another screen - should it just - * turn into a migrate effectively? I don't think there's a situation - * currently where no window is focused in the curent desktop, it's - * one of those things that's prevented from happening, until there's - * no windows left in the desktop. The screens are just subregions - * of the current desktop which map to displays. - */ - } else if (keypress->state & ShiftMask) { + if (send_it || (keypress->state & ShiftMask)) { vwm_screen_rel_t rel; /* "migrate" the focused window to the next screen */ @@ -244,6 +231,15 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress) assert(0); } + if (send_it) { + /* "sending" only differs in that we try to focus the next window before migrating, + * if vwin is the only window, it stays focused, and this degrades gracefully into + * a migrate. This is done because we never leave a situation without any window + * focused in a desktop. + */ + vwm_win_focus_next(vwm, vwin, direction, VWM_FENCE_RESPECT); + } + vwm_win_autoconf(vwm, vwin, rel, vwin->autoconfigured, vwin->autoconfigured_param); } else { /* focus the MRU window on the next screen */ -- cgit v1.2.3