2
0
mirror of https://github.com/bakkeby/patches synced 2024-11-17 15:29:53 +00:00

barmodules: updating updatebarpos to take into account geometry for bars that are not shown on startup

This commit is contained in:
bakkeby 2020-07-27 10:54:39 +02:00
parent a4496efc4b
commit e757a967e5

View File

@ -1,4 +1,4 @@
From aab7c100daa2a3e5a7bffdea363a4a929d368fa2 Mon Sep 17 00:00:00 2001 From 28f4b76a62e78792a57099ef4975da628d62c2c9 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com> From: bakkeby <bakkeby@gmail.com>
Date: Sun, 19 Jul 2020 19:26:10 +0200 Date: Sun, 19 Jul 2020 19:26:10 +0200
Subject: [PATCH] Bar Modules - splits the bar functionality into individual Subject: [PATCH] Bar Modules - splits the bar functionality into individual
@ -6,7 +6,7 @@ Subject: [PATCH] Bar Modules - splits the bar functionality into individual
--- ---
config.def.h | 20 +++ config.def.h | 20 +++
dwm.c | 379 ++++++++++++++++++++++++++++++++----------- dwm.c | 378 ++++++++++++++++++++++++++++++++-----------
patch/bar_ltsymbol.c | 17 ++ patch/bar_ltsymbol.c | 17 ++
patch/bar_ltsymbol.h | 3 + patch/bar_ltsymbol.h | 3 +
patch/bar_status.c | 19 +++ patch/bar_status.c | 19 +++
@ -17,7 +17,7 @@ Subject: [PATCH] Bar Modules - splits the bar functionality into individual
patch/bar_wintitle.h | 3 + patch/bar_wintitle.h | 3 +
patch/include.c | 5 + patch/include.c | 5 +
patch/include.h | 5 + patch/include.h | 5 +
12 files changed, 449 insertions(+), 96 deletions(-) 12 files changed, 448 insertions(+), 96 deletions(-)
create mode 100644 patch/bar_ltsymbol.c create mode 100644 patch/bar_ltsymbol.c
create mode 100644 patch/bar_ltsymbol.h create mode 100644 patch/bar_ltsymbol.h
create mode 100644 patch/bar_status.c create mode 100644 patch/bar_status.c
@ -61,7 +61,7 @@ index 1c0b587..2534eac 100644
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */ static const int nmaster = 1; /* number of clients in master area */
diff --git a/dwm.c b/dwm.c diff --git a/dwm.c b/dwm.c
index 4465af1..e897a0b 100644 index 4465af1..77017b3 100644
--- a/dwm.c --- a/dwm.c
+++ b/dwm.c +++ b/dwm.c
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
@ -603,7 +603,7 @@ index 4465af1..e897a0b 100644
} }
} }
@@ -1825,12 +1989,31 @@ updatebarpos(Monitor *m) @@ -1825,12 +1989,30 @@ updatebarpos(Monitor *m)
{ {
m->wy = m->my; m->wy = m->my;
m->wh = m->mh; m->wh = m->mh;
@ -618,6 +618,12 @@ index 4465af1..e897a0b 100644
+ int y_pad = 0; + int y_pad = 0;
+ int x_pad = 0; + int x_pad = 0;
+ +
+ for (bar = m->bar; bar; bar = bar->next) {
+ bar->bx = m->mx + x_pad;
+ bar->bw = m->ww - 2 * x_pad;
+ bar->bh = bh;
+ }
+
+ if (!m->showbar) { + if (!m->showbar) {
+ for (bar = m->bar; bar; bar = bar->next) + for (bar = m->bar; bar; bar = bar->next)
+ bar->by = -bh - y_pad; + bar->by = -bh - y_pad;
@ -629,19 +635,12 @@ index 4465af1..e897a0b 100644
+ m->wy = m->my + bh + y_pad; + m->wy = m->my + bh + y_pad;
+ m->wh = m->wh - y_pad * num_bars - bh * num_bars; + m->wh = m->wh - y_pad * num_bars - bh * num_bars;
+ +
+ for (bar = m->bar; bar; bar = bar->next) { + for (bar = m->bar; bar; bar = bar->next)
+ bar->bx = m->mx + x_pad; + bar->by = (bar->topbar ? m->wy - bh : m->wy + m->wh);
+ bar->bw = m->ww - 2 * x_pad;
+ bar->bh = bh;
+ if (bar->topbar)
+ bar->by = m->wy - bh;
+ else
+ bar->by = m->wy + m->wh;
+ }
} }
void void
@@ -1987,9 +2170,11 @@ updatesizehints(Client *c) @@ -1987,9 +2169,11 @@ updatesizehints(Client *c)
void void
updatestatus(void) updatestatus(void)
{ {
@ -654,7 +653,7 @@ index 4465af1..e897a0b 100644
} }
void void
@@ -2063,12 +2248,14 @@ wintomon(Window w) @@ -2063,12 +2247,14 @@ wintomon(Window w)
int x, y; int x, y;
Client *c; Client *c;
Monitor *m; Monitor *m;