From 4b5e9070ca9c8b3486f57628ad746da63d77e1e5 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 15 Feb 2025 14:48:40 -0800 Subject: key: support reversing migrating by screen --- src/key.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/key.c b/src/key.c index 3786d47..2c2a3fd 100644 --- a/src/key.c +++ b/src/key.c @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -228,9 +229,22 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress) * of the current desktop which map to displays. */ } else if (keypress->state & ShiftMask) { + vwm_screen_rel_t rel; + /* "migrate" the focused window to the next screen */ - vwm_win_autoconf(vwm, vwin, VWM_SCREEN_REL_XWIN_NEXT, vwin->autoconfigured, vwin->autoconfigured_param); - /* TODO reverse via VWM_SCREEN_REL_XWIN_PREV */ + + switch (direction) { + case VWM_DIRECTION_FORWARD: + rel = VWM_SCREEN_REL_XWIN_NEXT; + break; + case VWM_DIRECTION_REVERSE: + rel = VWM_SCREEN_REL_XWIN_PREV; + break; + default: + assert(0); + } + + vwm_win_autoconf(vwm, vwin, rel, vwin->autoconfigured, vwin->autoconfigured_param); } else { /* focus the MRU window on the next screen */ vwm_win_focus_next(vwm, vwin, direction, VWM_FENCE_MASKED_VIOLATE); -- cgit v1.2.3