summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-22 08:43:07 +0200
committerbakkeby <[email protected]>2020-08-22 08:43:07 +0200
commit110cc7d24042d88521a5edd67adf35eb5d949776 (patch)
tree9752df419472892b495ff7759fd4e786bbebb109 /patch
parent81488b4862487c6debed8f447db217d2d2c78ecb (diff)
downloaddwm-flexipatch-110cc7d24042d88521a5edd67adf35eb5d949776.tar.gz
dwm-flexipatch-110cc7d24042d88521a5edd67adf35eb5d949776.zip
Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients)
Diffstat (limited to 'patch')
-rw-r--r--patch/bar_awesomebar.c2
-rw-r--r--patch/bar_fancybar.c2
-rw-r--r--patch/bar_flexwintitle.c8
-rw-r--r--patch/bar_flexwintitle.h2
-rw-r--r--patch/bar_powerline_tags.c2
-rw-r--r--patch/bar_status2d.c2
-rw-r--r--patch/bar_systray.c6
-rw-r--r--patch/bar_tabgroups.c8
-rw-r--r--patch/bar_tabgroups.h2
-rw-r--r--patch/bar_taggrid.c2
-rw-r--r--patch/bar_tags.c2
-rw-r--r--patch/bar_wintitle.c67
-rw-r--r--patch/bar_wintitle_floating.c8
-rw-r--r--patch/bar_wintitle_floating.h2
-rw-r--r--patch/bar_wintitle_hidden.c8
-rw-r--r--patch/bar_wintitle_hidden.h2
16 files changed, 63 insertions, 62 deletions
diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c
index 613e8d9..750c99a 100644
--- a/patch/bar_awesomebar.c
+++ b/patch/bar_awesomebar.c
@@ -46,7 +46,7 @@ draw_awesomebar(Bar *bar, BarDrawArg *a)
x += tabw + (i < remainder ? 1 : 0);
}
}
- return a->x + a->w;
+ return n;
}
int
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
index b32181d..0ddf7ed 100644
--- a/patch/bar_fancybar.c
+++ b/patch/bar_fancybar.c
@@ -65,7 +65,7 @@ draw_fancybar(Bar *bar, BarDrawArg *a)
w -= ftw;
}
}
- return x + w;
+ return n;
}
int
diff --git a/patch/bar_flexwintitle.c b/patch/bar_flexwintitle.c
index 603af8f..cb43048 100644
--- a/patch/bar_flexwintitle.c
+++ b/patch/bar_flexwintitle.c
@@ -44,8 +44,7 @@ int
draw_flexwintitle(Bar *bar, BarDrawArg *a)
{
drw_rect(drw, a->x, 0, a->w, bh, 1, 1);
- flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL);
- return a->x + a->w;
+ return flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL);
}
int
@@ -244,7 +243,7 @@ flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *
arg->v = c;
}
-void
+int
flextitlecalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
@@ -310,7 +309,7 @@ flextitlecalculate(
n = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden;
if (n == 0)
- return;
+ return 0;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
@@ -448,4 +447,5 @@ flextitlecalculate(
rr -= clientsnhidden;
c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg); // floating
}
+ return 1;
} \ No newline at end of file
diff --git a/patch/bar_flexwintitle.h b/patch/bar_flexwintitle.h
index 56647c6..be7b675 100644
--- a/patch/bar_flexwintitle.h
+++ b/patch/bar_flexwintitle.h
@@ -4,7 +4,7 @@ static int click_flexwintitle(Bar *bar, Arg *arg, BarClickArg *a);
static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg);
static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg);
-static void flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg);
+static int flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg);
static int getschemefor(Monitor *m, int group, int activegroup);
static int getselschemefor(int scheme);
static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file
diff --git a/patch/bar_powerline_tags.c b/patch/bar_powerline_tags.c
index 20f9227..b5cf390 100644
--- a/patch/bar_powerline_tags.c
+++ b/patch/bar_powerline_tags.c
@@ -90,7 +90,7 @@ draw_pwrl_tags(Bar *bar, BarDrawArg *a)
#else
drw_arrow(drw, x, 0, plw, bh, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
- return a->x + a->w;
+ return 1;
}
int
diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c
index d4a1e06..744fa18 100644
--- a/patch/bar_status2d.c
+++ b/patch/bar_status2d.c
@@ -164,7 +164,7 @@ drawstatusbar(int x, char* stext)
free(p);
drw_setscheme(drw, scheme[SchemeNorm]);
- return x;
+ return i;
}
int
diff --git a/patch/bar_systray.c b/patch/bar_systray.c
index 0ff730d..dc267fb 100644
--- a/patch/bar_systray.c
+++ b/patch/bar_systray.c
@@ -17,7 +17,7 @@ int
draw_systray(Bar *bar, BarDrawArg *a)
{
if (!showsystray)
- return a->x;
+ return 0;
XSetWindowAttributes wa;
Client *i;
@@ -61,7 +61,7 @@ draw_systray(Bar *bar, BarDrawArg *a)
fprintf(stderr, "dwm: unable to obtain system tray.\n");
free(systray);
systray = NULL;
- return a->x;
+ return 0;
}
}
@@ -86,7 +86,7 @@ draw_systray(Bar *bar, BarDrawArg *a)
}
XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by : -bar->by), MAX(w, 1), bar->bh);
- return a->x + a->w;
+ return w;
}
int
diff --git a/patch/bar_tabgroups.c b/patch/bar_tabgroups.c
index 7036882..b4b2b0a 100644
--- a/patch/bar_tabgroups.c
+++ b/patch/bar_tabgroups.c
@@ -34,8 +34,7 @@ int
draw_bartabgroups(Bar *bar, BarDrawArg *a)
{
drw_rect(drw, a->x, 0, a->w, bh, 1, 1);
- bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL);
- return a->x + a->w;
+ return bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL);
}
int
@@ -105,7 +104,7 @@ bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg
arg->v = c;
}
-void
+int
bartabcalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
@@ -143,7 +142,7 @@ bartabcalculate(
}
if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
- return;
+ return 0;
tgactive = 1;
num = tabw;
@@ -230,4 +229,5 @@ bartabcalculate(
}
#endif // BARTAB_FLOATWEIGHT
}
+ return 1;
} \ No newline at end of file
diff --git a/patch/bar_tabgroups.h b/patch/bar_tabgroups.h
index 15f6876..113701f 100644
--- a/patch/bar_tabgroups.h
+++ b/patch/bar_tabgroups.h
@@ -4,4 +4,4 @@ static int click_bartabgroups(Bar *bar, Arg *arg, BarClickArg *a);
static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg);
static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg);
-static void bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file
+static int bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file
diff --git a/patch/bar_taggrid.c b/patch/bar_taggrid.c
index ebd07c1..0bdf105 100644
--- a/patch/bar_taggrid.c
+++ b/patch/bar_taggrid.c
@@ -53,7 +53,7 @@ draw_taggrid(Bar *bar, BarDrawArg *a)
}
y += h;
}
- return max_x;
+ return 1;
}
int
diff --git a/patch/bar_tags.c b/patch/bar_tags.c
index f122602..0a7e628 100644
--- a/patch/bar_tags.c
+++ b/patch/bar_tags.c
@@ -92,7 +92,7 @@ draw_tags(Bar *bar, BarDrawArg *a)
x += w;
}
- return x;
+ return 1;
}
int
diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c
index ca30138..7f28fd3 100644
--- a/patch/bar_wintitle.c
+++ b/patch/bar_wintitle.c
@@ -23,42 +23,43 @@ draw_wintitle(Bar *bar, BarDrawArg *a)
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
Monitor *m = bar->mon;
- if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
- #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
- XSetErrorHandler(xerrordummy);
- #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
- #if BAR_CENTEREDWINDOWNAME_PATCH
- int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x;
- #if BAR_PANGO_PATCH
- drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False);
- #else
- drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
- #endif // BAR_PANGO_PATCH
- #else
- #if BAR_PANGO_PATCH
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
- #else
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
- #endif // BAR_PANGO_PATCH
- #endif // BAR_CENTEREDWINDOWNAME_PATCH
- #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
- XSync(dpy, False);
- XSetErrorHandler(xerror);
- #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
- if (m->sel->isfloating)
- #if BAR_ACTIVETAGINDICATORBAR_PATCH
- drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0);
- #elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
- drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 0);
- #else
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
- #endif // BAR_ACTIVETAGINDICATORBAR_PATCH
- } else {
+ if (!m->sel) {
drw_setscheme(drw, scheme[SchemeTitleNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
+ return 0;
}
- return x + w;
+
+ drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
+ #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
+ XSetErrorHandler(xerrordummy);
+ #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
+ #if BAR_CENTEREDWINDOWNAME_PATCH
+ int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x;
+ #if BAR_PANGO_PATCH
+ drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False);
+ #else
+ drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
+ #endif // BAR_PANGO_PATCH
+ #else
+ #if BAR_PANGO_PATCH
+ drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
+ #else
+ drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+ #endif // BAR_PANGO_PATCH
+ #endif // BAR_CENTEREDWINDOWNAME_PATCH
+ #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
+ XSync(dpy, False);
+ XSetErrorHandler(xerror);
+ #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
+ if (m->sel->isfloating)
+ #if BAR_ACTIVETAGINDICATORBAR_PATCH
+ drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0);
+ #elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
+ drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 0);
+ #else
+ drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
+ #endif // BAR_ACTIVETAGINDICATORBAR_PATCH
+ return 1;
}
int
diff --git a/patch/bar_wintitle_floating.c b/patch/bar_wintitle_floating.c
index 3fea3c2..e4aea1d 100644
--- a/patch/bar_wintitle_floating.c
+++ b/patch/bar_wintitle_floating.c
@@ -8,8 +8,7 @@ int
draw_wintitle_floating(Bar *bar, BarDrawArg *a)
{
drw_rect(drw, a->x, 0, a->w, bh, 1, 1);
- calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL);
- return a->x + a->w;
+ return calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL);;
}
int
@@ -19,7 +18,7 @@ click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a)
return ClkWinTitle;
}
-void
+int
calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
@@ -36,9 +35,10 @@ calc_wintitle_floating(
}
if (!clientsnfloating)
- return;
+ return 0;
w = tabw / clientsnfloating;
r = tabw % clientsnfloating;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg);
+ return 1;
} \ No newline at end of file
diff --git a/patch/bar_wintitle_floating.h b/patch/bar_wintitle_floating.h
index 3e6164a..7c6a5c1 100644
--- a/patch/bar_wintitle_floating.h
+++ b/patch/bar_wintitle_floating.h
@@ -1,7 +1,7 @@
static int width_wintitle_floating(Bar *bar, BarWidthArg *a);
static int draw_wintitle_floating(Bar *bar, BarDrawArg *a);
static int click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a);
-static void calc_wintitle_floating(
+static int calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
); \ No newline at end of file
diff --git a/patch/bar_wintitle_hidden.c b/patch/bar_wintitle_hidden.c
index 729f6aa..95e8378 100644
--- a/patch/bar_wintitle_hidden.c
+++ b/patch/bar_wintitle_hidden.c
@@ -8,8 +8,7 @@ int
draw_wintitle_hidden(Bar *bar, BarDrawArg *a)
{
drw_rect(drw, a->x, 0, a->w, bh, 1, 1);
- calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL);
- return a->x + a->w;
+ return calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL);;
}
int
@@ -19,7 +18,7 @@ click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a)
return ClkWinTitle;
}
-void
+int
calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
@@ -36,9 +35,10 @@ calc_wintitle_hidden(
}
if (!clientsnhidden)
- return;
+ return 0;
w = tabw / clientsnhidden;
r = tabw % clientsnhidden;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg);
+ return 1;
} \ No newline at end of file
diff --git a/patch/bar_wintitle_hidden.h b/patch/bar_wintitle_hidden.h
index 2382e91..aaa1be7 100644
--- a/patch/bar_wintitle_hidden.h
+++ b/patch/bar_wintitle_hidden.h
@@ -1,7 +1,7 @@
static int width_wintitle_hidden(Bar *bar, BarWidthArg *a);
static int draw_wintitle_hidden(Bar *bar, BarDrawArg *a);
static int click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a);
-static void calc_wintitle_hidden(
+static int calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
); \ No newline at end of file