nixos-dotfiles

nixos-dotfiles

https://git.tonybtw.com/nixos-dotfiles.git git://git.tonybtw.com/nixos-dotfiles.git
4,561 bytes raw
1
Common subdirectories: dwm/.git and dwm-new/.git
2
diff -up dwm/config.def.h dwm-new/config.def.h
3
--- dwm/config.def.h	2019-12-10 17:24:37.944708263 +1300
4
+++ dwm-new/config.def.h	2019-12-10 17:44:38.447670711 +1300
5
@@ -5,6 +5,8 @@ static const unsigned int borderpx  = 1;
6
 static const unsigned int snap      = 32;       /* snap pixel */
7
 static const int showbar            = 1;        /* 0 means no bar */
8
 static const int topbar             = 1;        /* 0 means bottom bar */
9
+static const int vertpad            = 10;       /* vertical padding of bar */
10
+static const int sidepad            = 10;       /* horizontal padding of bar */
11
 static const char *fonts[]          = { "monospace:size=10" };
12
 static const char dmenufont[]       = "monospace:size=10";
13
 static const char col_gray1[]       = "#222222";
14
diff -up dwm/dwm.c dwm-new/dwm.c
15
--- dwm/dwm.c	2019-12-10 17:24:37.945708263 +1300
16
+++ dwm-new/dwm.c	2019-12-10 17:41:46.192676099 +1300
17
@@ -241,6 +241,8 @@ static int screen;
18
 static int sw, sh;           /* X display screen geometry width, height */
19
 static int bh, blw = 0;      /* bar geometry */
20
 static int lrpad;            /* sum of left and right padding for text */
21
+static int vp;               /* vertical padding for bar */
22
+static int sp;               /* side padding for bar */
23
 static int (*xerrorxlib)(Display *, XErrorEvent *);
24
 static unsigned int numlockmask = 0;
25
 static void (*handler[LASTEvent]) (XEvent *) = {
26
@@ -567,7 +569,7 @@ configurenotify(XEvent *e)
27
 				for (c = m->clients; c; c = c->next)
28
 					if (c->isfullscreen)
29
 						resizeclient(c, m->mx, m->my, m->mw, m->mh);
30
-				XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
31
+				XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww -  2 * sp, bh);
32
 			}
33
 			focus(NULL);
34
 			arrange(NULL);
35
@@ -705,7 +707,7 @@ drawbar(Monitor *m)
36
 	if (m == selmon) { /* status is only drawn on selected monitor */
37
 		drw_setscheme(drw, scheme[SchemeNorm]);
38
 		sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
39
-		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
40
+		drw_text(drw, m->ww - sw - 2 * sp, 0, sw, bh, 0, stext, 0);
41
 	}
42
 
43
 	for (c = m->clients; c; c = c->next) {
44
@@ -731,12 +733,12 @@ drawbar(Monitor *m)
45
 	if ((w = m->ww - sw - x) > bh) {
46
 		if (m->sel) {
47
 			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
48
-			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
49
+			drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
50
 			if (m->sel->isfloating)
51
 				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
52
 		} else {
53
 			drw_setscheme(drw, scheme[SchemeNorm]);
54
-			drw_rect(drw, x, 0, w, bh, 1, 1);
55
+			drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
56
 		}
57
 	}
58
 	drw_map(drw, m->barwin, 0, 0, m->ww, bh);
59
@@ -1547,6 +1549,9 @@ setup(void)
60
 	lrpad = drw->fonts->h;
61
 	bh = drw->fonts->h + 2;
62
 	updategeom();
63
+	sp = sidepad;
64
+	vp = (topbar == 1) ? vertpad : - vertpad;
65
+
66
 	/* init atoms */
67
 	utf8string = XInternAtom(dpy, "UTF8_STRING", False);
68
 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
69
@@ -1573,6 +1578,7 @@ setup(void)
70
 	/* init bars */
71
 	updatebars();
72
 	updatestatus();
73
+	updatebarpos(selmon);
74
 	/* supporting window for NetWMCheck */
75
 	wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
76
 	XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
77
@@ -1701,7 +1707,7 @@ togglebar(const Arg *arg)
78
 {
79
 	selmon->showbar = !selmon->showbar;
80
 	updatebarpos(selmon);
81
-	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
82
+	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
83
 	arrange(selmon);
84
 }
85
 
86
@@ -1811,7 +1817,7 @@ updatebars(void)
87
 	for (m = mons; m; m = m->next) {
88
 		if (m->barwin)
89
 			continue;
90
-		m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
91
+		m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
92
 				CopyFromParent, DefaultVisual(dpy, screen),
93
 				CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
94
 		XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
95
@@ -1826,11 +1832,11 @@ updatebarpos(Monitor *m)
96
 	m->wy = m->my;
97
 	m->wh = m->mh;
98
 	if (m->showbar) {
99
-		m->wh -= bh;
100
-		m->by = m->topbar ? m->wy : m->wy + m->wh;
101
-		m->wy = m->topbar ? m->wy + bh : m->wy;
102
+		m->wh = m->wh - vertpad - bh;
103
+		m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
104
+		m->wy = m->topbar ? m->wy + bh + vp : m->wy;
105
 	} else
106
-		m->by = -bh;
107
+		m->by = -bh - vp;
108
 }
109
 
110
 void