summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-01 16:58:43 +0200
committerbakkeby <[email protected]>2020-08-01 16:58:43 +0200
commitf87bd6c86e59d05f1f5920dab2c961831aeaa072 (patch)
tree6e5516b16565bad31e4e5ac4ef3c3fd9eea5d930
parentd85dc0404f5542b4d9800e2db91df7a577b7f6f2 (diff)
downloaddwm-flexipatch-f87bd6c86e59d05f1f5920dab2c961831aeaa072.tar.gz
dwm-flexipatch-f87bd6c86e59d05f1f5920dab2c961831aeaa072.zip
Fix for focustack not being able to focus past hidden windows.
Also focusstack +2/-2 allow hidden windows to be selected using keyboard shortcuts in order to unhide them via showhideclient. Ref. https://www.reddit.com/r/suckless/comments/i1c66t/how_to_make_awesomebar_patch_more_keyboard_centric/
-rw-r--r--dwm.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/dwm.c b/dwm.c
index d60d58e..0f8e05b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1048,7 +1048,6 @@ clientmessage(XEvent *e)
c->next = systray->icons;
systray->icons = c;
XGetWindowAttributes(dpy, c->win, &wa);
-
c->x = c->oldx = c->y = c->oldy = 0;
c->w = c->oldw = wa.width;
c->h = c->oldh = wa.height;
@@ -1609,13 +1608,8 @@ expose(XEvent *e)
void
focus(Client *c)
{
- #if BAR_AWESOMEBAR_PATCH
- if (!c || !ISVISIBLE(c) || HIDDEN(c))
- for (c = selmon->stack; c && (!ISVISIBLE(c) || HIDDEN(c)); c = c->snext);
- #else
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
- #endif // BAR_AWESOMEBAR_PATCH
if (selmon->sel && selmon->sel != c)
unfocus(selmon->sel, 0);
if (c) {
@@ -1682,6 +1676,21 @@ focusstack(const Arg *arg)
if (selmon->sel->isfullscreen)
return;
#endif // ALWAYSFULLSCREEN_PATCH
+ #if BAR_AWESOMEBAR_PATCH
+ if (arg->i > 0) {
+ for (c = selmon->sel->next; c && (!ISVISIBLE(c) || (arg->i == 1 && HIDDEN(c))); c = c->next);
+ if (!c)
+ for (c = selmon->clients; c && (!ISVISIBLE(c) || (arg->i == 1 && HIDDEN(c))); c = c->next);
+ } else {
+ for (i = selmon->clients; i != selmon->sel; i = i->next)
+ if (ISVISIBLE(i) && !(arg->i == -1 && HIDDEN(i)))
+ c = i;
+ if (!c)
+ for (; i; i = i->next)
+ if (ISVISIBLE(i) && !(arg->i == -1 && HIDDEN(i)))
+ c = i;
+ }
+ #else
if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
if (!c)
@@ -1695,6 +1704,7 @@ focusstack(const Arg *arg)
if (ISVISIBLE(i))
c = i;
}
+ #endif // BAR_AWESOMEBAR_PATCH
if (c) {
focus(c);
restack(selmon);