Adding the toggletopbar patch ref. #363

pull/369/head
bakkeby 11 months ago
parent 3881ad4ad1
commit 10a6640732

@ -19,6 +19,8 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
### Changelog: ### Changelog:
2023-06-25 - Added the toggletopbar patch
2023-01-18 - Added the view history patch 2023-01-18 - Added the view history patch
2022-10-08 - Added the alt-tab patch 2022-10-08 - Added the alt-tab patch
@ -772,15 +774,18 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [togglefullscreen](https://github.com/bakkeby/patches/wiki/togglefullscreen/) - [togglefullscreen](https://github.com/bakkeby/patches/wiki/togglefullscreen/)
- allows you to toggle fullscreen on and off using a single shortcut key - allows you to toggle fullscreen on and off using a single shortcut key
- [togglelayout](https://github.com/bakkeby/patches/wiki/togglelayout)
- toggle layout using the same keyboard shortcuts to set the layout
- e.g. hitting `MOD+m` switches to monocle layout, hitting the same keybinding again brings
you back to the previous layout
- [toggletag](https://github.com/bakkeby/patches/wiki/toggletag) - [toggletag](https://github.com/bakkeby/patches/wiki/toggletag)
- toggle tags using the same keyboard shortcuts to view tags - toggle tags using the same keyboard shortcuts to view tags
- e.g. hitting `MOD+4` lets you view tag 4 and hitting the keybinding a second time brings - e.g. hitting `MOD+4` lets you view tag 4 and hitting the keybinding a second time brings
you back to where you were before you back to where you were before
- [togglelayout](https://github.com/bakkeby/patches/wiki/togglelayout) - [toggletopbar](https://dwm.suckless.org/patches/toggletopbar/)
- toggle layout using the same keyboard shortcuts to set the layout - allows for the bar position (top or bottom) to be toggled during runtime
- e.g. hitting `MOD+m` switches to monocle layout, hitting the same keybinding again brings
you back to the previous layout
- [transfer](https://dwm.suckless.org/patches/transfer/) - [transfer](https://dwm.suckless.org/patches/transfer/)
- lets you transfer the currently focused client between the master and stack area while - lets you transfer the currently focused client between the master and stack area while

@ -902,6 +902,9 @@ static const Key keys[] = {
{ MODKEY, XK_s, rioresize, {0} }, { MODKEY, XK_s, rioresize, {0} },
#endif // RIODRAW_PATCH #endif // RIODRAW_PATCH
{ MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_b, togglebar, {0} },
#if TOGGLETOPBAR_PATCH
{ MODKEY|ShiftMask, XK_b, toggletopbar, {0} },
#endif // TOGGLETOPBAR_PATCH
#if TAB_PATCH #if TAB_PATCH
{ MODKEY|ControlMask, XK_b, tabmode, {-1} }, { MODKEY|ControlMask, XK_b, tabmode, {-1} },
#endif // TAB_PATCH #endif // TAB_PATCH
@ -1394,6 +1397,9 @@ static const Signal signals[] = {
{ "focusstack", focusstack }, { "focusstack", focusstack },
{ "setmfact", setmfact }, { "setmfact", setmfact },
{ "togglebar", togglebar }, { "togglebar", togglebar },
#if TOGGLETOPBAR_PATCH
{ "toggletopbar", toggletopbar },
#endif // TOGGLETOPBAR_PATCH
{ "incnmaster", incnmaster }, { "incnmaster", incnmaster },
{ "togglefloating", togglefloating }, { "togglefloating", togglefloating },
{ "focusmon", focusmon }, { "focusmon", focusmon },
@ -1592,6 +1598,9 @@ static IPCCommand ipccommands[] = {
IPCCOMMAND( tag, 1, {ARG_TYPE_UINT} ), IPCCOMMAND( tag, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( tagmon, 1, {ARG_TYPE_UINT} ), IPCCOMMAND( tagmon, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( togglebar, 1, {ARG_TYPE_NONE} ), IPCCOMMAND( togglebar, 1, {ARG_TYPE_NONE} ),
#if TOGGLETOPBAR_PATCH
IPCCOMMAND( toggletopbar, 1, {ARG_TYPE_NONE} ),
#endif // TOGGLETOPBAR_PATCH
IPCCOMMAND( togglefloating, 1, {ARG_TYPE_NONE} ), IPCCOMMAND( togglefloating, 1, {ARG_TYPE_NONE} ),
IPCCOMMAND( toggletag, 1, {ARG_TYPE_UINT} ), IPCCOMMAND( toggletag, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( toggleview, 1, {ARG_TYPE_UINT} ), IPCCOMMAND( toggleview, 1, {ARG_TYPE_UINT} ),

@ -30,6 +30,7 @@ case $# in
transferall) ;& transferall) ;&
togglealttag) ;& togglealttag) ;&
togglebar) ;& togglebar) ;&
toggletopbar) ;&
togglefloating) ;& togglefloating) ;&
togglefullscreen) ;& togglefullscreen) ;&
fullscreen) ;& fullscreen) ;&

@ -310,6 +310,9 @@
#if TOGGLEFULLSCREEN_PATCH #if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.c" #include "togglefullscreen.c"
#endif #endif
#if TOGGLETOPBAR_PATCH
#include "toggletopbar.c"
#endif
#if TRANSFER_PATCH #if TRANSFER_PATCH
#include "transfer.c" #include "transfer.c"
#endif #endif

@ -312,6 +312,9 @@
#if TOGGLEFULLSCREEN_PATCH #if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.h" #include "togglefullscreen.h"
#endif #endif
#if TOGGLETOPBAR_PATCH
#include "toggletopbar.h"
#endif
#if TRANSFER_PATCH #if TRANSFER_PATCH
#include "transfer.h" #include "transfer.h"
#endif #endif

@ -0,0 +1,20 @@
void
toggletopbar(const Arg *arg)
{
Bar *bar;
Monitor *m = selmon;
for (bar = m->bar; bar; bar = bar->next)
bar->topbar = !bar->topbar;
if (!m->showbar) {
togglebar(NULL);
return;
}
updatebarpos(m);
for (bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
arrange(m);
}

@ -0,0 +1 @@
static void toggletopbar(const Arg *arg);

@ -1255,6 +1255,11 @@
*/ */
#define TOGGLEFULLSCREEN_PATCH 0 #define TOGGLEFULLSCREEN_PATCH 0
/* This patch allows for the bar position (top or bottom) to be toggled during runtime.
* https://dwm.suckless.org/patches/toggletopbar/
*/
#define TOGGLETOPBAR_PATCH 0
/* Minor patch that lets you use the same keyboard shortcut to toggle to the previous layout if the /* Minor patch that lets you use the same keyboard shortcut to toggle to the previous layout if the
* designated layout is already active. * designated layout is already active.
* *

Loading…
Cancel
Save