From 7574031f980f6b133c1b986b69d81976437caad8 Mon Sep 17 00:00:00 2001 From: Alexander Leonhardt Date: Sun, 18 Oct 2026 12:53:18 +0200 Subject: Allowed cycling in monocle mode with established movement commands --- dwl.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dwl.c b/dwl.c index 87a1ef0..97803bb 100644 --- a/dwl.c +++ b/dwl.c @@ -1894,6 +1894,33 @@ focusmon(const Arg *arg) } + +void +focusstack(const Arg *arg) +{ + /* Focus the next or previous client (in tiling order) on selmon */ + Client *c, *sel = focustop(selmon); + if (!sel || (sel->isfullscreen && !client_has_children(sel))) + return; + if (arg->i > 0) { + wl_list_for_each(c, &sel->link, link) { + if (&c->link == &clients) + continue; /* wrap past the sentinel node */ + if (VISIBLEON(c, selmon)) + break; /* found it */ + } + } else { + wl_list_for_each_reverse(c, &sel->link, link) { + if (&c->link == &clients) + continue; /* wrap past the sentinel node */ + if (VISIBLEON(c, selmon)) + break; /* found it */ + } + } + /* If only one client is visible on selmon, then c == sel */ + focusclient(c, 1); +} + void focusdir(const Arg *arg) { /* Focus the left, right, up, down client relative to the current focused client on selmon */ @@ -1934,6 +1961,14 @@ void focusdir(const Arg *arg) if (newsel != NULL){ focusclient(newsel, 1); } + else if(arg->ui == 2) { + Arg a = {.i=-1}; + focusstack(&a); + } + else if (arg->ui == 3) { + Arg a = {.i=1}; + focusstack(&a); + } } -- cgit