[wiki] [sites] add systray-toggle patch to the systray page || Christopher Witt

From: <git_AT_suckless.org>
Date: Fri, 01 May 2020 22:12:56 +0200

commit c298c58d02ee431e071632b24c444a6b3b1b3d10
Author: Christopher Witt <github_AT_ch-witt.de>
Date: Fri May 1 20:07:59 2020 +0200

    add systray-toggle patch to the systray page

diff --git a/dwm.suckless.org/patches/systray/dwm-systray-toogle-6.2.diff b/dwm.suckless.org/patches/systray/dwm-systray-toogle-6.2.diff
new file mode 100644
index 00000000..d7ce348b
--- /dev/null
+++ b/dwm.suckless.org/patches/systray/dwm-systray-toogle-6.2.diff
_AT_@ -0,0 +1,63 @@
+From 727d0569a7bb7920887cb5b34707201ba72d1e76 Mon Sep 17 00:00:00 2001
+From: Christopher Witt <github_AT_ch-witt.de>
+Date: Sat, 25 Apr 2020 21:37:15 +0200
+Subject: [PATCH] systray-toggle to show/hide the systray
+
+---
+ config.def.h | 3 ++-
+ dwm.c | 14 ++++++++++++++
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 2d824d1..fb7dc0c 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -6,7 +6,7 @@ static const unsigned int snap = 32; /* snap pixel */
+ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
+ static const unsigned int systrayspacing = 2; /* systray spacing */
+ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
+-static const int showsystray = 1; /* 0 means no systray */
++static int showsystray = 1; /* 0 means no systray */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
+ static const char *fonts[] = { "monospace:size=10" };
+_AT_@ -68,6 +68,7 @@ static Key keys[] = {
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
++ { MODKEY|ShiftMask, XK_b, togglesystray, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+diff --git a/dwm.c b/dwm.c
+index 1b90b7b..530ef32 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -240,6 +240,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 togglesystray();
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+_AT_@ -1908,6 +1909,19 @@ togglebar(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++togglesystray()
++{
++ if (showsystray)
++ XUnmapWindow(dpy, systray->win);
++ showsystray = !showsystray;
++ updatesystray();
++ drawbar(selmon);
++}
++
+ void
+ togglefloating(const Arg *arg)
+ {
+--
+2.26.2
+
diff --git a/dwm.suckless.org/patches/systray/index.md b/dwm.suckless.org/patches/systray/index.md
index c3767cc5..b223de1d 100644
--- a/dwm.suckless.org/patches/systray/index.md
+++ b/dwm.suckless.org/patches/systray/index.md
_AT_@ -17,6 +17,10 @@ Download
 * [dwm-git-20130119-systray.diff](dwm-git-20130119-systray.diff) (19946b)
 * [dwm-systray-6.0.diff](dwm-systray-6.0.diff) (19788b) (20130119)
 
+Apply the following patch on top of the systray patch to have a keybind for showing/hiding the systray.
+
+* [dwm-systray-toggle-6.2.diff](dwm-systray-6.2.diff) (2465b)
+
 Author
 ------
 * Jan Christoph Ebersbach <jceb_AT_e-jc.de>
_AT_@ -24,3 +28,4 @@ Author
 * David Phillips (5ed9c48 (6.1), 20160103, 20180314)
 * Eric Pruitt (7af4d43 (20160626))
 * Igor Gevka (cb3f58a (6.2), 20200216)
+* Christopher Witt <git_AT_ch-witt.de> (systray-toggle-6.2)
Received on Fri May 01 2020 - 22:12:56 CEST

This archive was generated by hypermail 2.3.0 : Fri May 01 2020 - 22:24:57 CEST