summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-07-09 15:24:32 +0200
committerbakkeby <[email protected]>2020-07-09 15:24:32 +0200
commit1d8aef219871b9c390ddea724fbc3eaea0b521a4 (patch)
treeb08bfe5f3b768a89535533d2b82b59efc906a3d6
parent474c91ea0c300f785821598a7c8e3252708cacbd (diff)
downloaddwm-flexipatch-1d8aef219871b9c390ddea724fbc3eaea0b521a4.tar.gz
dwm-flexipatch-1d8aef219871b9c390ddea724fbc3eaea0b521a4.zip
awesomebar: refactoring remainder logic, which seemed a bit off
-rw-r--r--dwm.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index e6f0f2b..c3bb411 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1827,8 +1827,8 @@ drawbar(Monitor *m)
#if AWESOMEBAR_PATCH
if (n > 0) {
remainder = w % n;
- tabw = (1.0 / (double)n) * w + 1;
- for (c = m->clients; c; c = c->next) {
+ tabw = w / n;
+ for (i = 0, c = m->clients; c; c = c->next, i++) {
if (!ISVISIBLE(c))
continue;
if (m->sel == c)
@@ -1849,15 +1849,10 @@ drawbar(Monitor *m)
#endif // VTCOLORS_PATCH
drw_setscheme(drw, scheme[scm]);
- if (remainder >= 0) {
- if (remainder == 0)
- tabw--;
- remainder--;
- }
#if PANGO_PATCH
- drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0, False);
+ drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0, False);
#else
- drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
+ drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0);
#endif // PANGO_PATCH
x += tabw;
}