commit c1d2cd783a907f978a3a3da983fcc894d28dd186
Author: speedie <[email protected]>
Date:   Sun Nov 20 16:10:47 2022 +0100

    Add a toggletopbar patch.
    
    toggletopbar allows the user to change position of the bar during
    runtime with a simple keybind.
    
    Also include a barpadding version which solves an issue where the bar
    will be placed outside the screen when toggled.

diff --git a/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-6.4.diff 
b/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-6.4.diff
new file mode 100644
index 00000000..90d0970e
--- /dev/null
+++ b/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-6.4.diff
@@ -0,0 +1,38 @@
+diff -up a/config.def.h b/config.def.h
+--- a/config.def.h     2022-10-04 19:38:18.000000000 +0200
++++ b/config.def.h     2022-10-22 14:12:40.528975869 +0200
+@@ -64,6 +64,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/dwm.c b/dwm.c
+--- a/dwm.c    2022-10-04 19:38:18.000000000 +0200
++++ b/dwm.c    2022-10-22 14:12:14.142976534 +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);
+@@ -1701,6 +1702,15 @@ togglebar(const Arg *arg)
+       updatebarpos(selmon);
+       XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, 
selmon->ww, bh);
+       arrange(selmon);
++}
++
++void
++toggletopbar(const Arg *arg)
++{
++    selmon->topbar = !selmon->topbar;
++      updatebarpos(selmon);
++      XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, 
selmon->ww, bh);
++      arrange(selmon);
+ }
+ 
+ void
diff --git 
a/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-barpadding-6.4.diff 
b/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-barpadding-6.4.diff
new file mode 100644
index 00000000..982fa3da
--- /dev/null
+++ b/dwm.suckless.org/patches/toggletopbar/dwm-toggletopbar-barpadding-6.4.diff
@@ -0,0 +1,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)
+ {
diff --git a/dwm.suckless.org/patches/toggletopbar/index.md 
b/dwm.suckless.org/patches/toggletopbar/index.md
new file mode 100644
index 00000000..e63d6cee
--- /dev/null
+++ b/dwm.suckless.org/patches/toggletopbar/index.md
@@ -0,0 +1,19 @@
+toggletopbar
+=========
+
+Description
+-----------
+This very simple patch adds a keybind (by default MODKEY + t) which changes 
the position of the bar during runtime.
+
+Because of the way the barpadding patch works, there needs to be a special 
patch for barpadding users as otherwise the bar will be positioned outside the 
screen. This patch should be applied on top of barpadding.
+
+The systray patch will also conflict, but only if barpadding is patched as 
well. To solve this, see [this 
commit](https://codeberg.org/speedie/speedwm/commit/0b9551fffe868c2efac6b3639443073c967d895c.patch)
 and [this 
commit](https://codeberg.org/speedie/speedwm/commit/1003d20915b7fab1492e3b7ea1c5038fa11ad324.patch).
 Adapt this to your own build.
+
+Download
+--------
+* [dwm-toggletopbar-6.4.diff](dwm-toggletopbar-6.4.diff)
+* [dwm-toggletopbar-barpadding-6.4.diff](dwm-toggletopbar-barpadding-6.4.diff)
+
+Author
+------
+* speedie <[email protected]>


Reply via email to