diff options
Diffstat (limited to 'dwl-patches/patches/rotate-clients/rotate-clients.patch')
-rw-r--r-- | dwl-patches/patches/rotate-clients/rotate-clients.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dwl-patches/patches/rotate-clients/rotate-clients.patch b/dwl-patches/patches/rotate-clients/rotate-clients.patch new file mode 100644 index 0000000..8f5f557 --- /dev/null +++ b/dwl-patches/patches/rotate-clients/rotate-clients.patch @@ -0,0 +1,56 @@ +diff --git a/config.def.h b/config.def.h +index 22d2171..6029666 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -129,6 +129,8 @@ static const Key keys[] = { + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, + { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, + { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, ++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, rotate_clients, {.i = +1} }, ++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, rotate_clients, {.i = -1} }, + { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, + { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, + { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, +diff --git a/dwl.c b/dwl.c +index a2711f6..6dfd87d 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -355,6 +355,7 @@ static Monitor *xytomon(double x, double y); + static void xytonode(double x, double y, struct wlr_surface **psurface, + Client **pc, LayerSurface **pl, double *nx, double *ny); + static void zoom(const Arg *arg); ++static void rotate_clients(const Arg *arg); + + /* variables */ + static const char broken[] = "broken"; +@@ -3054,6 +3055,30 @@ zoom(const Arg *arg) + arrange(selmon); + } + ++static void rotate_clients(const Arg *arg) { ++ Monitor* m = selmon; ++ Client *c; ++ Client *first = NULL; ++ Client *last = NULL; ++ ++ if (arg->i == 0) ++ return; ++ ++ wl_list_for_each(c, &clients, link) { ++ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) { ++ if (first == NULL) first = c; ++ last = c; ++ } ++ } ++ if (first != last) { ++ struct wl_list *append_to = (arg->i > 0) ? &last->link : first->link.prev; ++ struct wl_list *elem = (arg->i > 0) ? &first->link : &last->link; ++ wl_list_remove(elem); ++ wl_list_insert(append_to, elem); ++ arrange(selmon); ++ } ++} ++ + #ifdef XWAYLAND + void + activatex11(struct wl_listener *listener, void *data) |