Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-barpadding-20211020-a786211.diff - sites - public wiki contents of suckless…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-barpadding-20211020-a786211.diff (4555B)
---
1 From a3cfb215f7f647d83d67e33df8f33a73e43bd65f Mon Sep 17 00:00:00 2001
2 From: Bakkeby <[email protected]>
3 Date: Wed, 20 Oct 2021 09:14:07 +0200
4 Subject: [PATCH] barpadding: adds space between the statusbar and the ed…
5 the screen
6
7 ---
8 config.def.h | 2 ++
9 dwm.c | 25 +++++++++++++++----------
10 2 files changed, 17 insertions(+), 10 deletions(-)
11
12 diff --git a/config.def.h b/config.def.h
13 index a2ac963..f0b739f 100644
14 --- a/config.def.h
15 +++ b/config.def.h
16 @@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* borde…
17 static const unsigned int snap = 32; /* snap pixel */
18 static const int showbar = 1; /* 0 means no bar */
19 static const int topbar = 1; /* 0 means bottom bar */
20 +static const int vertpad = 10; /* vertical padding of …
21 +static const int sidepad = 10; /* horizontal padding o…
22 static const char *fonts[] = { "monospace:size=10" };
23 static const char dmenufont[] = "monospace:size=10";
24 static const char col_gray1[] = "#222222";
25 diff --git a/dwm.c b/dwm.c
26 index 5e4d494..df6d0d7 100644
27 --- a/dwm.c
28 +++ b/dwm.c
29 @@ -242,6 +242,8 @@ static int screen;
30 static int sw, sh; /* X display screen geometry width, height…
31 static int bh, blw = 0; /* bar geometry */
32 static int lrpad; /* sum of left and right padding for text …
33 +static int vp; /* vertical padding for bar */
34 +static int sp; /* side padding for bar */
35 static int (*xerrorxlib)(Display *, XErrorEvent *);
36 static unsigned int numlockmask = 0;
37 static void (*handler[LASTEvent]) (XEvent *) = {
38 @@ -568,7 +570,7 @@ configurenotify(XEvent *e)
39 for (c = m->clients; c; c = c->next)
40 if (c->isfullscreen)
41 resizeclient(c, m->mx, …
42 - XMoveResizeWindow(dpy, m->barwin, m->wx…
43 + XMoveResizeWindow(dpy, m->barwin, m->wx…
44 }
45 focus(NULL);
46 arrange(NULL);
47 @@ -706,7 +708,7 @@ drawbar(Monitor *m)
48 if (m == selmon) { /* status is only drawn on selected monitor …
49 drw_setscheme(drw, scheme[SchemeNorm]);
50 tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
51 - drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
52 + drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext,…
53 }
54
55 for (c = m->clients; c; c = c->next) {
56 @@ -732,12 +734,12 @@ drawbar(Monitor *m)
57 if ((w = m->ww - tw - x) > bh) {
58 if (m->sel) {
59 drw_setscheme(drw, scheme[m == selmon ? SchemeS…
60 - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->n…
61 + drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, …
62 if (m->sel->isfloating)
63 drw_rect(drw, x + boxs, boxs, boxw, box…
64 } else {
65 drw_setscheme(drw, scheme[SchemeNorm]);
66 - drw_rect(drw, x, 0, w, bh, 1, 1);
67 + drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
68 }
69 }
70 drw_map(drw, m->barwin, 0, 0, m->ww, bh);
71 @@ -1547,7 +1549,10 @@ setup(void)
72 die("no fonts could be loaded.");
73 lrpad = drw->fonts->h;
74 bh = drw->fonts->h + 2;
75 + sp = sidepad;
76 + vp = (topbar == 1) ? vertpad : - vertpad;
77 updategeom();
78 +
79 /* init atoms */
80 utf8string = XInternAtom(dpy, "UTF8_STRING", False);
81 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
82 @@ -1704,7 +1709,7 @@ togglebar(const Arg *arg)
83 {
84 selmon->showbar = !selmon->showbar;
85 updatebarpos(selmon);
86 - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, …
87 + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon-…
88 arrange(selmon);
89 }
90
91 @@ -1814,7 +1819,7 @@ updatebars(void)
92 for (m = mons; m; m = m->next) {
93 if (m->barwin)
94 continue;
95 - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->w…
96 + m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by …
97 CopyFromParent, DefaultVisual(dpy, scre…
98 CWOverrideRedirect|CWBackPixmap|CWEvent…
99 XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor…
100 @@ -1829,11 +1834,11 @@ updatebarpos(Monitor *m)
101 m->wy = m->my;
102 m->wh = m->mh;
103 if (m->showbar) {
104 - m->wh -= bh;
105 - m->by = m->topbar ? m->wy : m->wy + m->wh;
106 - m->wy = m->topbar ? m->wy + bh : m->wy;
107 + m->wh = m->wh - vertpad - bh;
108 + m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
109 + m->wy = m->topbar ? m->wy + bh + vp : m->wy;
110 } else
111 - m->by = -bh;
112 + m->by = -bh - vp;
113 }
114
115 void
116 --
117 2.33.0
118
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.