2
0
mirror of https://github.com/bakkeby/patches synced 2024-11-07 15:20:22 +00:00

systray may not always exist

This commit is contained in:
bakkeby 2020-09-07 13:01:41 +02:00
parent 8039b26b86
commit 2ec8c2d4c8

View File

@ -1,4 +1,4 @@
From dab4012e6c61d27a39e4938cdc384c72e39f2ab2 Mon Sep 17 00:00:00 2001 From dd88b0115deb4c9f42fc392e68ac8e72b5ed6877 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com> From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 11:19:12 +0200 Date: Mon, 20 Jul 2020 11:19:12 +0200
Subject: [PATCH 2/2] Adding systray module Subject: [PATCH 2/2] Adding systray module
@ -36,7 +36,7 @@ index 2534eac..d17b65c 100644
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" }, { -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
}; };
diff --git a/dwm.c b/dwm.c diff --git a/dwm.c b/dwm.c
index 03dccfb..a6c6d72 100644 index 03dccfb..ca79f5f 100644
--- a/dwm.c --- a/dwm.c
+++ b/dwm.c +++ b/dwm.c
@@ -63,6 +63,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ @@ -63,6 +63,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@ -177,7 +177,7 @@ index 03dccfb..a6c6d72 100644
static XWindowAttributes wa; static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest; XMapRequestEvent *ev = &e->xmaprequest;
+ if (showsystray && (i = wintosystrayicon(ev->window))) { + if (showsystray && systray && (i = wintosystrayicon(ev->window))) {
+ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION); + sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
+ drawbarwin(systray->bar); + drawbarwin(systray->bar);
+ } + }
@ -289,7 +289,7 @@ index 03dccfb..a6c6d72 100644
diff --git a/patch/bar_systray.c b/patch/bar_systray.c diff --git a/patch/bar_systray.c b/patch/bar_systray.c
new file mode 100644 new file mode 100644
index 0000000..0ff730d index 0000000..b1efe88
--- /dev/null --- /dev/null
+++ b/patch/bar_systray.c +++ b/patch/bar_systray.c
@@ -0,0 +1,187 @@ @@ -0,0 +1,187 @@
@ -447,7 +447,7 @@ index 0000000..0ff730d
+ long flags; + long flags;
+ int code = 0; + int code = 0;
+ +
+ if (!showsystray || !i || ev->atom != xatom[XembedInfo] || + if (!showsystray || !systray || !i || ev->atom != xatom[XembedInfo] ||
+ !(flags = getatomprop(i, xatom[XembedInfo]))) + !(flags = getatomprop(i, xatom[XembedInfo])))
+ return; + return;
+ +
@ -480,7 +480,6 @@ index 0000000..0ff730d
+ for (i = systray->icons; i && i->win != w; i = i->next); + for (i = systray->icons; i && i->win != w; i = i->next);
+ return i; + return i;
+} +}
\ No newline at end of file
diff --git a/patch/bar_systray.h b/patch/bar_systray.h diff --git a/patch/bar_systray.h b/patch/bar_systray.h
new file mode 100644 new file mode 100644
index 0000000..5123a73 index 0000000..5123a73