summaryrefslogtreecommitdiff
path: root/dwm/patches/dwm-toggletopbar-barpadding-6.4.diff
blob: 982fa3da74b89159c22424ead0445a39e72d7a6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff -up a/config.def.h b/config.def.h
--- a/config.def.h	2022-10-28 22:20:44.531059708 +0200
+++ b/config.def.h	2022-10-28 22:21:12.621059000 +0200
@@ -67,6 +67,7 @@ static const Key keys[] = {
 	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
 	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
 	{ MODKEY,                       XK_b,      togglebar,      {0} },
+	{ MODKEY,                       XK_t,      toggletopbar,   {0} },
 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
 	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
diff -up a/b.c b/b.c
--- a/b.c	2022-10-28 22:20:44.532059708 +0200
+++ b/b.c	2022-10-28 22:23:27.019055613 +0200
@@ -211,6 +211,7 @@ static void tag(const Arg *arg);
 static void tagmon(const Arg *arg);
 static void tile(Monitor *m);
 static void togglebar(const Arg *arg);
+static void toggletopbar(const Arg *arg);
 static void togglefloating(const Arg *arg);
 static void toggletag(const Arg *arg);
 static void toggleview(const Arg *arg);
@@ -1710,6 +1711,20 @@ togglebar(const Arg *arg)
 	arrange(selmon);
 }
 
+void
+toggletopbar(const Arg *arg)
+{
+    selmon->topbar = !selmon->topbar;
+	updatebarpos(selmon);
+
+	if (selmon->topbar)
+	    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
+	else
+	    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by - vp, selmon->ww - 2 * sp, bh);
+
+	arrange(selmon);
+}
+
 void
 togglefloating(const Arg *arg)
 {