diff options
| author | 0scar <qgt268@alumni.ku.dk> | 2023-03-12 15:37:11 +0000 |
|---|---|---|
| committer | 0scar <qgt268@alumni.ku.dk> | 2024-10-01 11:57:23 +0000 |
| commit | 1fadd97647f6849f04d673bb98b75c8fe2683ea8 (patch) | |
| tree | 439fcbe47ddb43918ad6288aa2afa7e60dc6c1d7 | |
| parent | e67193d9b10627b010cd35790962915c4327d845 (diff) | |
Patch: extend foccusstack to enable focus first or last
| -rw-r--r-- | dwl.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1610,7 +1610,21 @@ focusstack(const Arg *arg) Client *c, *sel = focustop(selmon); if (!sel || (sel->isfullscreen && !client_has_children(sel))) return; - if (arg->i > 0) { + /* If i == 0 select the first client */ + if (arg->i == 0) { + wl_list_for_each(c, &clients, link) { + if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen) + continue; + break; + } + /* If i == INT_MAX select the last client */ + } else if (arg->i == INT_MAX) { + wl_list_for_each_reverse(c, &clients, link) { + if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen) + continue; + break; + } + } else if (arg->i > 0) { wl_list_for_each(c, &sel->link, link) { if (&c->link == &clients) continue; /* wrap past the sentinel node */ |
