[wiki] [sites] Initial patch relied on the keyrelease code from the combo patch. Fixed this and made dwm-holdbar a standalone patch with no dependencies. || hsszyman

From: <git_AT_suckless.org>
Date: Wed, 26 Jun 2019 20:00:11 +0200

commit 54cc62fa0cbd2a909fa0084f84d77479ce369083
Author: hsszyman <hsszyman_AT_gmail.com>
Date: Wed Jun 26 13:59:20 2019 -0400

    Initial patch relied on the keyrelease code from the combo patch. Fixed this and made dwm-holdbar a standalone patch with no dependencies.

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 24baa842..0ff44eb5 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,18 +1,15 @@
-From bf92ad15a2732993dc9543386ccedac12363cc05 Mon Sep 17 00:00:00 2001
+From 6663a23fc0abce840bbbd31cec36434ee52a93b3 Mon Sep 17 00:00:00 2001
 From: hsszyman <hsszyman_AT_gmail.com>
-Date: Wed, 26 Jun 2019 01:41:23 -0400
-Subject: [PATCH] This patch enables the status bar only when holding down the
- mod key
-
-This can be fairly nifty if you want to save as much room as possible, while still having quick ( and frequent ) access to the status bar.
+Date: Wed, 26 Jun 2019 13:48:41 -0400
+Subject: [PATCH] holdbar
 
 ---
- config.def.h | 3 ++-
- dwm.c | 17 +++++++++++++++++
- 2 files changed, 19 insertions(+), 1 deletion(-)
+ config.def.h | 5 +++--
+ dwm.c | 24 ++++++++++++++++++++++--
+ 2 files changed, 25 insertions(+), 4 deletions(-)
 
 diff --git a/config.def.h b/config.def.h
-index e084020..b455f82 100644
+index 1c0b587..82c88d5 100644
 --- a/config.def.h
 +++ b/config.def.h
 _AT_@ -3,7 +3,7 @@
_AT_@ -24,53 +21,94 @@ index e084020..b455f82 100644
  static const int topbar = 1; /* 0 means bottom bar */
  static const char *fonts[] = { "monospace:size=10" };
  static const char dmenufont[] = "monospace:size=10";
-_AT_@ -64,6 +64,7 @@ static Key keys[] = {
- { MODKEY, XK_p, spawn, {.v = dmenucmd } },
- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
- { MODKEY, XK_b, togglebar, {0} },
-+ { 0, XK_Super_L, holdbar, {0} },
- { MODKEY, XK_j, focusstack, {.i = +1 } },
- { MODKEY, XK_k, focusstack, {.i = -1 } },
- { MODKEY, XK_i, incnmaster, {.i = +1 } },
+_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} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
+_AT_@ -94,6 +94,7 @@ static Key keys[] = {
+ TAGKEYS( XK_8, 7)
+ TAGKEYS( XK_9, 8)
+ { MODKEY|ShiftMask, XK_q, quit, {0} },
++ { 0, XK_Super_L,holdbar, {0} },
+ };
+
+ /* button definitions */
 diff --git a/dwm.c b/dwm.c
-index 2097259..1795abe 100644
+index 4465af1..1933e2d 100644
 --- a/dwm.c
 +++ b/dwm.c
-_AT_@ -239,6 +239,7 @@ static void zoom(const Arg *arg);
- static void keyrelease(XEvent *e);
- static void combotag(const Arg *arg);
- static void comboview(const Arg *arg);
+_AT_@ -176,6 +176,7 @@ static void grabbuttons(Client *c, int focused);
+ static void grabkeys(void);
+ static void incnmaster(const Arg *arg);
+ static void keypress(XEvent *e);
++static void keyrelease(XEvent *e);
+ static void killclient(const Arg *arg);
+ static void manage(Window w, XWindowAttributes *wa);
+ static void mappingnotify(XEvent *e);
+_AT_@ -210,6 +211,7 @@ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
 +static void holdbar(const Arg *arg);
-
-
- /* variables */
-_AT_@ -286,10 +287,26 @@ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+ 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 *);
+ static unsigned int numlockmask = 0;
+ static void (*handler[LASTEvent]) (XEvent *) = {
+ [ButtonPress] = buttonpress,
++ [ButtonRelease] = keyrelease,
+ [ClientMessage] = clientmessage,
+ [ConfigureRequest] = configurerequest,
+ [ConfigureNotify] = configurenotify,
+_AT_@ -252,6 +255,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+ [EnterNotify] = enternotify,
+ [Expose] = expose,
+ [FocusIn] = focusin,
++ [KeyRelease] = keyrelease,
+ [KeyPress] = keypress,
+ [MappingNotify] = mappingnotify,
+ [MapRequest] = maprequest,
+_AT_@ -275,6 +279,24 @@ static Window root, wmcheckwin;
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  
  /* function implementations */
- static int combo = 0;
-+static int hold = 0;
 +
-
- void
- keyrelease(XEvent *e) {
- combo = 0;
-+ 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);
-+ }
++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);
++ }
 +}
 +
 +void
 +holdbar(const Arg *arg)
 +{
-+ selmon->showbar = 1;
-+ updatebarpos(selmon);
-+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
- }
-
++ selmon->showbar = 1;
++ updatebarpos(selmon);
++ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, 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 c4f28707..6482ea88 100644
--- a/dwm.suckless.org/patches/holdbar/index.md
+++ b/dwm.suckless.org/patches/holdbar/index.md
_AT_@ -3,7 +3,22 @@ holdbar
 
 Description
 -----------
-This patch disables the status bar by default and instead reveals it every time the MOD key is pressed. It's useful if you want to save some extra screenspace but still make use of the features from the default dwm bar.
+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
+
+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
+
 
 Download
 --------
Received on Wed Jun 26 2019 - 20:00:11 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 26 2019 - 20:00:32 CEST