From 3f4f88c1428c8f2057488daa34fe7d4c131d9594 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 4 Aug 2020 13:40:26 +0200 Subject: [PATCH] awesomebar: use previously tiled when hiding client and the hidden client was the last tiled client --- patch/bar_awesomebar.c | 12 +++++++++++- patch/bar_awesomebar.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c index 5a3a588..75155fb 100644 --- a/patch/bar_awesomebar.c +++ b/patch/bar_awesomebar.c @@ -116,7 +116,7 @@ hide(Client *c) { } else { n = nexttiled(c); if (!n) - n = nexttiled(c->mon->clients); + n = prevtiled(c); } focus(n); arrange(c->mon); @@ -149,6 +149,16 @@ togglewin(const Arg *arg) } } +Client * +prevtiled(Client *c) +{ + Client *p, *i; + for (p = NULL, i = c->mon->clients; c && i != c; i = i->next) + if (ISVISIBLE(i) && !HIDDEN(i)) + p = i; + return p; +} + void showhideclient(const Arg *arg) { diff --git a/patch/bar_awesomebar.h b/patch/bar_awesomebar.h index a99986e..83572f6 100644 --- a/patch/bar_awesomebar.h +++ b/patch/bar_awesomebar.h @@ -5,4 +5,5 @@ static int click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a); static void hide(Client *c); static void show(Client *c); static void togglewin(const Arg *arg); +static Client *prevtiled(Client *c); static void showhideclient(const Arg *arg); \ No newline at end of file