aboutsummaryrefslogtreecommitdiffstats
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c35
1 files changed, 35 insertions, 0 deletions
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);
+ }
}