[wiki] [sites] Removed unneeded modifications from patch (such as changing MODMASK), removed hardcoding from holdbar keybind, and the patch will no longer modify any code related to the togglebar. || hsszyman

From: <git_AT_suckless.org>
Date: Thu, 04 Jul 2019 05:48:54 +0200

commit b82d1858e8f742d7237dcb735a08c1ae14199c0d
Author: hsszyman <hsszyman_AT_gmail.com>
Date: Wed Jul 3 23:47:05 2019 -0400

    Removed unneeded modifications from patch (such as changing MODMASK), removed hardcoding from holdbar keybind, and the patch will no longer modify any code related to the togglebar.

diff --git a/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff b/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
index 0ff44eb5..bcad100b 100644
--- a/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
+++ b/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
_AT_@ -1,45 +1,35 @@
-From 6663a23fc0abce840bbbd31cec36434ee52a93b3 Mon Sep 17 00:00:00 2001
+From 5c1a4a448007664439350ed645206198411eb9d1 Mon Sep 17 00:00:00 2001
 From: hsszyman <hsszyman_AT_gmail.com>
-Date: Wed, 26 Jun 2019 13:48:41 -0400
-Subject: [PATCH] holdbar
+Date: Wed, 3 Jul 2019 23:32:57 -0400
+Subject: [PATCH] Fixed broken bottom bar and removed key hardcoding
 
 ---
- config.def.h | 5 +++--
- dwm.c | 24 ++++++++++++++++++++++--
- 2 files changed, 25 insertions(+), 4 deletions(-)
+ config.def.h | 2 ++
+ dwm.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 42 insertions(+)
 
 diff --git a/config.def.h b/config.def.h
-index 1c0b587..82c88d5 100644
+index 1c0b587..0e19b5d 100644
 --- a/config.def.h
 +++ b/config.def.h
-_AT_@ -3,7 +3,7 @@
- /* appearance */
- static const unsigned int borderpx = 1; /* border pixel of windows */
- static const unsigned int snap = 32; /* snap pixel */
--static const int showbar = 1; /* 0 means no bar */
-+static const int showbar = 0; /* 0 means no bar */
- static const int topbar = 1; /* 0 means bottom bar */
- static const char *fonts[] = { "monospace:size=10" };
- static const char dmenufont[] = "monospace:size=10";
-_AT_@ -44,7 +44,7 @@ static const Layout layouts[] = {
- };
-
- /* key definitions */
--#define MODKEY Mod1Mask
-+#define MODKEY Mod4Mask
- #define TAGKEYS(KEY,TAG) \
- { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+_AT_@ -50,6 +50,7 @@ static const Layout layouts[] = {
          { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
-_AT_@ -94,6 +94,7 @@ static Key keys[] = {
+ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
++#define HOLDKEY 0 // replace 0 with the keysym to activate holdbar
+
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+_AT_@ -94,6 +95,7 @@ static Key keys[] = {
          TAGKEYS( XK_8, 7)
          TAGKEYS( XK_9, 8)
          { MODKEY|ShiftMask, XK_q, quit, {0} },
-+ { 0, XK_Super_L,holdbar, {0} },
++ { 0, HOLDKEY, holdbar, {0} },
  };
  
  /* button definitions */
 diff --git a/dwm.c b/dwm.c
-index 4465af1..1933e2d 100644
+index 4465af1..4237031 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -176,6 +176,7 @@ static void grabbuttons(Client *c, int focused);
_AT_@ -58,57 +48,72 @@ index 4465af1..1933e2d 100644
  static void togglefloating(const Arg *arg);
  static void toggletag(const Arg *arg);
  static void toggleview(const Arg *arg);
-_AT_@ -245,6 +247,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
+_AT_@ -217,6 +219,7 @@ static void unfocus(Client *c, int setfocus);
+ static void unmanage(Client *c, int destroyed);
+ static void unmapnotify(XEvent *e);
+ static void updatebarpos(Monitor *m);
++static void updateholdbarpos(Monitor *m);
+ static void updatebars(void);
+ static void updateclientlist(void);
+ static int updategeom(void);
+_AT_@ -245,6 +248,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
  static unsigned int numlockmask = 0;
  static void (*handler[LASTEvent]) (XEvent *) = {
          [ButtonPress] = buttonpress,
-+ [ButtonRelease] = keyrelease,
++ [ButtonRelease] = keyrelease,
          [ClientMessage] = clientmessage,
          [ConfigureRequest] = configurerequest,
          [ConfigureNotify] = configurenotify,
-_AT_@ -252,6 +255,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+_AT_@ -252,6 +256,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
          [EnterNotify] = enternotify,
          [Expose] = expose,
          [FocusIn] = focusin,
-+ [KeyRelease] = keyrelease,
++ [KeyRelease] = keyrelease,
          [KeyPress] = keypress,
          [MappingNotify] = mappingnotify,
          [MapRequest] = maprequest,
-_AT_@ -275,6 +279,24 @@ static Window root, wmcheckwin;
+_AT_@ -275,6 +280,41 @@ static Window root, wmcheckwin;
  struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  
  /* function implementations */
 +
++
 +void
-+keyrelease(XEvent *e) {
-+ if (e->xkey.keycode == XKeysymToKeycode(dpy, XK_Super_L)) {
-+ selmon->showbar = 0;
-+ updatebarpos(selmon);
-+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
-+ arrange(selmon);
-+ }
++holdbar(const Arg *arg)
++{
++ selmon->showbar = 1;
++ updateholdbarpos(selmon);
++ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
 +}
 +
++
 +void
-+holdbar(const Arg *arg)
++keyrelease(XEvent *e)
++{
++ if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)){
++ selmon->showbar = 0;
++ updateholdbarpos(selmon);
++ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
++ arrange(selmon);
++ }
++}
++
++void
++updateholdbarpos(Monitor *m)
 +{
-+ selmon->showbar = 1;
-+ updatebarpos(selmon);
-+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
++ m->wy = m->my;
++ m->wh = m->mh;
++ if (m->showbar) {
++ m->by = m->topbar ? m->wy : m->wy + m->wh - bh;
++ m->wy = m->topbar ? m->wy - bh + bh : m->wy;
++ } else {
++ m->by = -bh;
++ }
 +}
++
  void
  applyrules(Client *c)
  {
-_AT_@ -1826,9 +1848,7 @@ updatebarpos(Monitor *m)
- m->wy = m->my;
- m->wh = m->mh;
- if (m->showbar) {
-- m->wh -= bh;
- m->by = m->topbar ? m->wy : m->wy + m->wh;
-- m->wy = m->topbar ? m->wy + bh : m->wy;
- } else
- m->by = -bh;
- }
 --
 2.22.0
 
diff --git a/dwm.suckless.org/patches/holdbar/index.md b/dwm.suckless.org/patches/holdbar/index.md
index 6482ea88..fdf2a3e5 100644
--- a/dwm.suckless.org/patches/holdbar/index.md
+++ b/dwm.suckless.org/patches/holdbar/index.md
_AT_@ -3,21 +3,12 @@ holdbar
 
 Description
 -----------
-This patch does 3 things:
-1. Disables status bar by default
-2. Changes the Mod key to the super key (MOD4)
-3. Modifies super key behavior so that the status bar shows whenever MOD4 is held down
+Dwm's built-in status bar is now only shown when HOLDKEY is pressed. In addition the bar will now overlay the display. This will work regardless of the topbar setting.
+This is meant to be used with the bar off my default
 
-This is useful if you want to save as much screen space as possible but still want frequent access to the information it provides.
-
-NOTE: This also modifies the status bar so that it only overlays windows. No readjustment will happen upon tag switches either.
-
-Directions
-----------
-On a fresh dwm install do
-1. git apply (PATCHDIR)/dwm-holdbar-6.2.diff
-2. in project dir, sudo make clean install
-3. Restart manager
+Notes
+-----
+None of the togglebar code has been removed, although you might want to remove the togglebar binding in your config.def.h.
 
 
 Download
Received on Thu Jul 04 2019 - 05:48:54 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 04 2019 - 06:00:30 CEST