mirror of https://github.com/bakkeby/patches
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
4.3 KiB
Diff
130 lines
4.3 KiB
Diff
From 0b3ccbe6eca11239d354c874125f2f7fea6f8613 Mon Sep 17 00:00:00 2001
|
|
From: Bakkeby <bakkeby@gmail.com>
|
|
Date: Fri, 1 Jul 2022 17:11:31 +0200
|
|
Subject: [PATCH] Adding barpadding patch
|
|
|
|
---
|
|
config.def.h | 2 ++
|
|
dwm.c | 28 ++++++++++++++++------------
|
|
2 files changed, 18 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index a2ac963..c9d182b 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
|
static const unsigned int snap = 32; /* snap pixel */
|
|
static const int showbar = 1; /* 0 means no bar */
|
|
static const int topbar = 1; /* 0 means bottom bar */
|
|
+static int vp = 10; /* vertical padding of bar */
|
|
+static int sp = 10; /* horizontal padding of bar */
|
|
static const char *fonts[] = { "monospace:size=10" };
|
|
static const char dmenufont[] = "monospace:size=10";
|
|
static const char col_gray1[] = "#222222";
|
|
diff --git a/dwm.c b/dwm.c
|
|
index a96f33c..f021110 100644
|
|
--- a/dwm.c
|
|
+++ b/dwm.c
|
|
@@ -116,7 +116,7 @@ struct Monitor {
|
|
float mfact;
|
|
int nmaster;
|
|
int num;
|
|
- int by; /* bar geometry */
|
|
+ int bx, by, bw; /* bar geometry */
|
|
int mx, my, mw, mh; /* screen size */
|
|
int wx, wy, ww, wh; /* window area */
|
|
unsigned int seltags;
|
|
@@ -440,7 +440,7 @@ buttonpress(XEvent *e)
|
|
arg.ui = 1 << i;
|
|
} else if (ev->x < x + blw)
|
|
click = ClkLtSymbol;
|
|
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
|
+ else if (ev->x > selmon->bw - (int)TEXTW(stext))
|
|
click = ClkStatusText;
|
|
else
|
|
click = ClkWinTitle;
|
|
@@ -568,7 +568,7 @@ configurenotify(XEvent *e)
|
|
for (c = m->clients; c; c = c->next)
|
|
if (c->isfullscreen)
|
|
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
|
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
|
+ XMoveResizeWindow(dpy, m->barwin, m->bx, m->by, m->bw, bh);
|
|
}
|
|
focus(NULL);
|
|
arrange(NULL);
|
|
@@ -709,7 +709,7 @@ drawbar(Monitor *m)
|
|
if (m == selmon) { /* status is only drawn on selected monitor */
|
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
|
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
|
+ drw_text(drw, m->bw - tw, 0, tw, bh, 0, stext, 0);
|
|
}
|
|
|
|
for (c = m->clients; c; c = c->next) {
|
|
@@ -732,7 +732,7 @@ drawbar(Monitor *m)
|
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
|
|
|
- if ((w = m->ww - tw - x) > bh) {
|
|
+ if ((w = m->bw - tw - x) > bh) {
|
|
if (m->sel) {
|
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
|
@@ -743,7 +743,7 @@ drawbar(Monitor *m)
|
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
|
}
|
|
}
|
|
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
|
+ drw_map(drw, m->barwin, 0, 0, m->bw, bh);
|
|
}
|
|
|
|
void
|
|
@@ -1550,6 +1550,8 @@ setup(void)
|
|
die("no fonts could be loaded.");
|
|
lrpad = drw->fonts->h;
|
|
bh = drw->fonts->h + 2;
|
|
+ if (!topbar)
|
|
+ vp = -vp;
|
|
updategeom();
|
|
/* init atoms */
|
|
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
|
@@ -1707,7 +1709,7 @@ togglebar(const Arg *arg)
|
|
{
|
|
selmon->showbar = !selmon->showbar;
|
|
updatebarpos(selmon);
|
|
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
|
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->bx, selmon->by, selmon->bw, bh);
|
|
arrange(selmon);
|
|
}
|
|
|
|
@@ -1817,7 +1819,7 @@ updatebars(void)
|
|
for (m = mons; m; m = m->next) {
|
|
if (m->barwin)
|
|
continue;
|
|
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
|
+ m->barwin = XCreateWindow(dpy, root, m->bx, m->by, m->bw, bh, 0, DefaultDepth(dpy, screen),
|
|
CopyFromParent, DefaultVisual(dpy, screen),
|
|
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
|
@@ -1832,11 +1834,13 @@ updatebarpos(Monitor *m)
|
|
m->wy = m->my;
|
|
m->wh = m->mh;
|
|
if (m->showbar) {
|
|
- m->wh -= bh;
|
|
- m->by = m->topbar ? m->wy : m->wy + m->wh;
|
|
- m->wy = m->topbar ? m->wy + bh : m->wy;
|
|
+ m->bx = m->mx + sp;
|
|
+ m->bw = m->mw - 2 * sp;
|
|
+ m->wh = m->wh - bh - abs(vp);
|
|
+ m->by = m->topbar ? m->wy + vp : m->wy + m->wh + vp;
|
|
+ m->wy = m->topbar ? m->wy + bh + vp : m->wy;
|
|
} else
|
|
- m->by = -bh;
|
|
+ m->by = -bh - vp;
|
|
}
|
|
|
|
void
|
|
--
|
|
2.19.1
|
|
|