From 46591aa8472cb75d98372163c7a80021eb9d380d Mon Sep 17 00:00:00 2001 From: irrlicht Date: Sun, 12 Apr 2026 20:34:46 +0200 Subject: [PATCH] Movestack functionality --- config.h | 2 ++ dwl.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/config.h b/config.h index 546af1e..d20e85a 100644 --- a/config.h +++ b/config.h @@ -146,6 +146,8 @@ static const Key keys[] = { { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, shiftclient, {.i = +1} }, { MODKEY, XKB_KEY_Up, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_Down, focusstack, {.i = +1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, movestack, {.i = -1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, movestack, {.i = +1} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} }, diff --git a/dwl.c b/dwl.c index 2a05211..7eb317d 100644 --- a/dwl.c +++ b/dwl.c @@ -305,6 +305,7 @@ static void motionnotify(uint32_t time, struct wlr_input_device *device, double double sy, double sx_unaccel, double sy_unaccel); static void motionrelative(struct wl_listener *listener, void *data); static void moveresize(const Arg *arg); +static void movestack(const Arg *arg); static void outputmgrapply(struct wl_listener *listener, void *data); static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test); static void outputmgrtest(struct wl_listener *listener, void *data); @@ -1808,6 +1809,8 @@ unset_fullscreen: if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) setfullscreen(w, 0); } + if (c->mon) + focusclient(c, 1); } void @@ -3099,6 +3102,38 @@ xytonode(double x, double y, struct wlr_surface **psurface, if (pl) *pl = l; } +void +movestack(const Arg *arg) +{ + Client *c, *sel = focustop(selmon); + if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating) + return; + + if (arg->i > 0) { + wl_list_for_each(c, &sel->link, link) { + if (&c->link == &clients) + continue; + if (VISIBLEON(c, selmon) && !c->isfloating) + break; + } + } else { + wl_list_for_each_reverse(c, &sel->link, link) { + if (&c->link == &clients) + continue; + if (VISIBLEON(c, selmon) && !c->isfloating) + break; + } + } + if (c == sel) + return; + wl_list_remove(&sel->link); + if (arg->i > 0) + wl_list_insert(&c->link, &sel->link); + else + wl_list_insert(c->link.prev, &sel->link); + arrange(selmon); +} + void zoom(const Arg *arg) {