|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
From bf9f15f792dd00b172c9a5094a5455de0a60ff4a Mon Sep 17 00:00:00 2001
|
|
|
|
|
From a5897a4c6bc88009dd3cf905cb98190d09341fba Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: bakkeby <bakkeby@gmail.com>
|
|
|
|
|
Date: Tue, 7 Apr 2020 11:32:02 +0200
|
|
|
|
|
Subject: [PATCH] Adding systray patch
|
|
|
|
@ -6,8 +6,8 @@ Subject: [PATCH] Adding systray patch
|
|
|
|
|
Refer to https://dwm.suckless.org/patches/systray/
|
|
|
|
|
---
|
|
|
|
|
config.def.h | 4 +
|
|
|
|
|
dwm.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++----
|
|
|
|
|
2 files changed, 382 insertions(+), 28 deletions(-)
|
|
|
|
|
dwm.c | 408 +++++++++++++++++++++++++++++++++++++++++++++++----
|
|
|
|
|
2 files changed, 384 insertions(+), 28 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
|
|
|
index 1c0b587..dd8e07a 100644
|
|
|
|
@ -25,7 +25,7 @@ index 1c0b587..dd8e07a 100644
|
|
|
|
|
static const int topbar = 1; /* 0 means bottom bar */
|
|
|
|
|
static const char *fonts[] = { "monospace:size=10" };
|
|
|
|
|
diff --git a/dwm.c b/dwm.c
|
|
|
|
|
index 4465af1..7f3cc51 100644
|
|
|
|
|
index 4465af1..1f31fb7 100644
|
|
|
|
|
--- a/dwm.c
|
|
|
|
|
+++ b/dwm.c
|
|
|
|
|
@@ -57,12 +57,30 @@
|
|
|
|
@ -158,11 +158,13 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
click = ClkStatusText;
|
|
|
|
|
else
|
|
|
|
|
click = ClkWinTitle;
|
|
|
|
|
@@ -482,6 +519,11 @@ cleanup(void)
|
|
|
|
|
@@ -482,6 +519,13 @@ cleanup(void)
|
|
|
|
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
|
|
|
|
while (mons)
|
|
|
|
|
cleanupmon(mons);
|
|
|
|
|
+ if (showsystray) {
|
|
|
|
|
+ while (systray->icons)
|
|
|
|
|
+ removesystrayicon(systray->icons);
|
|
|
|
|
+ XUnmapWindow(dpy, systray->win);
|
|
|
|
|
+ XDestroyWindow(dpy, systray->win);
|
|
|
|
|
+ free(systray);
|
|
|
|
@ -170,7 +172,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
for (i = 0; i < CurLast; i++)
|
|
|
|
|
drw_cur_free(drw, cursor[i]);
|
|
|
|
|
for (i = 0; i < LENGTH(colors); i++)
|
|
|
|
|
@@ -512,9 +554,50 @@ cleanupmon(Monitor *mon)
|
|
|
|
|
@@ -512,9 +556,50 @@ cleanupmon(Monitor *mon)
|
|
|
|
|
void
|
|
|
|
|
clientmessage(XEvent *e)
|
|
|
|
|
{
|
|
|
|
@ -221,7 +223,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
if (!c)
|
|
|
|
|
return;
|
|
|
|
|
if (cme->message_type == netatom[NetWMState]) {
|
|
|
|
|
@@ -567,7 +650,7 @@ configurenotify(XEvent *e)
|
|
|
|
|
@@ -567,7 +652,7 @@ configurenotify(XEvent *e)
|
|
|
|
|
for (c = m->clients; c; c = c->next)
|
|
|
|
|
if (c->isfullscreen)
|
|
|
|
|
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
|
|
|
@ -230,7 +232,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
focus(NULL);
|
|
|
|
|
arrange(NULL);
|
|
|
|
|
@@ -652,6 +735,11 @@ destroynotify(XEvent *e)
|
|
|
|
|
@@ -652,6 +737,11 @@ destroynotify(XEvent *e)
|
|
|
|
|
|
|
|
|
|
if ((c = wintoclient(ev->window)))
|
|
|
|
|
unmanage(c, 1);
|
|
|
|
@ -242,7 +244,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@@ -695,19 +783,23 @@ dirtomon(int dir)
|
|
|
|
|
@@ -695,19 +785,23 @@ dirtomon(int dir)
|
|
|
|
|
void
|
|
|
|
|
drawbar(Monitor *m)
|
|
|
|
|
{
|
|
|
|
@ -268,7 +270,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
for (c = m->clients; c; c = c->next) {
|
|
|
|
|
occ |= c->tags;
|
|
|
|
|
if (c->isurgent)
|
|
|
|
|
@@ -728,7 +820,7 @@ drawbar(Monitor *m)
|
|
|
|
|
@@ -728,7 +822,7 @@ drawbar(Monitor *m)
|
|
|
|
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
|
|
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
|
|
|
|
|
|
|
|
@ -277,7 +279,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
if (m->sel) {
|
|
|
|
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
|
|
|
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
|
|
|
|
@@ -739,7 +831,7 @@ drawbar(Monitor *m)
|
|
|
|
|
@@ -739,7 +833,7 @@ drawbar(Monitor *m)
|
|
|
|
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -286,7 +288,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@@ -776,8 +868,11 @@ expose(XEvent *e)
|
|
|
|
|
@@ -776,8 +870,11 @@ expose(XEvent *e)
|
|
|
|
|
Monitor *m;
|
|
|
|
|
XExposeEvent *ev = &e->xexpose;
|
|
|
|
|
|
|
|
|
@ -299,7 +301,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@@ -862,10 +957,17 @@ getatomprop(Client *c, Atom prop)
|
|
|
|
|
@@ -862,10 +959,17 @@ getatomprop(Client *c, Atom prop)
|
|
|
|
|
unsigned long dl;
|
|
|
|
|
unsigned char *p = NULL;
|
|
|
|
|
Atom da, atom = None;
|
|
|
|
@ -318,7 +320,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
XFree(p);
|
|
|
|
|
}
|
|
|
|
|
return atom;
|
|
|
|
|
@@ -899,6 +1001,16 @@ getstate(Window w)
|
|
|
|
|
@@ -899,6 +1003,16 @@ getstate(Window w)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -335,7 +337,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
int
|
|
|
|
|
gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
|
|
|
|
{
|
|
|
|
|
@@ -1003,7 +1115,7 @@ killclient(const Arg *arg)
|
|
|
|
|
@@ -1003,7 +1117,7 @@ killclient(const Arg *arg)
|
|
|
|
|
{
|
|
|
|
|
if (!selmon->sel)
|
|
|
|
|
return;
|
|
|
|
@ -344,7 +346,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
XGrabServer(dpy);
|
|
|
|
|
XSetErrorHandler(xerrordummy);
|
|
|
|
|
XSetCloseDownMode(dpy, DestroyAll);
|
|
|
|
|
@@ -1091,6 +1203,12 @@ maprequest(XEvent *e)
|
|
|
|
|
@@ -1091,6 +1205,12 @@ maprequest(XEvent *e)
|
|
|
|
|
{
|
|
|
|
|
static XWindowAttributes wa;
|
|
|
|
|
XMapRequestEvent *ev = &e->xmaprequest;
|
|
|
|
@ -357,7 +359,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
|
|
|
|
|
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
|
|
|
|
return;
|
|
|
|
|
@@ -1215,6 +1333,16 @@ propertynotify(XEvent *e)
|
|
|
|
|
@@ -1215,6 +1335,16 @@ propertynotify(XEvent *e)
|
|
|
|
|
Window trans;
|
|
|
|
|
XPropertyEvent *ev = &e->xproperty;
|
|
|
|
|
|
|
|
|
@ -374,7 +376,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
|
|
|
|
updatestatus();
|
|
|
|
|
else if (ev->state == PropertyDelete)
|
|
|
|
|
@@ -1265,6 +1393,19 @@ recttomon(int x, int y, int w, int h)
|
|
|
|
|
@@ -1265,6 +1395,19 @@ recttomon(int x, int y, int w, int h)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -394,7 +396,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
void
|
|
|
|
|
resize(Client *c, int x, int y, int w, int h, int interact)
|
|
|
|
|
{
|
|
|
|
|
@@ -1272,6 +1413,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
|
|
|
|
|
@@ -1272,6 +1415,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
|
|
|
|
|
resizeclient(c, x, y, w, h);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -409,7 +411,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
void
|
|
|
|
|
resizeclient(Client *c, int x, int y, int w, int h)
|
|
|
|
|
{
|
|
|
|
|
@@ -1344,6 +1493,19 @@ resizemouse(const Arg *arg)
|
|
|
|
|
@@ -1344,6 +1495,19 @@ resizemouse(const Arg *arg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -429,7 +431,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
void
|
|
|
|
|
restack(Monitor *m)
|
|
|
|
|
{
|
|
|
|
|
@@ -1433,26 +1595,36 @@ setclientstate(Client *c, long state)
|
|
|
|
|
@@ -1433,26 +1597,36 @@ setclientstate(Client *c, long state)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
@ -477,7 +479,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
return exists;
|
|
|
|
|
}
|
|
|
|
|
@@ -1466,7 +1638,7 @@ setfocus(Client *c)
|
|
|
|
|
@@ -1466,7 +1640,7 @@ setfocus(Client *c)
|
|
|
|
|
XA_WINDOW, 32, PropModeReplace,
|
|
|
|
|
(unsigned char *) &(c->win), 1);
|
|
|
|
|
}
|
|
|
|
@ -486,7 +488,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@@ -1555,13 +1727,21 @@ setup(void)
|
|
|
|
|
@@ -1555,13 +1729,21 @@ setup(void)
|
|
|
|
|
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
|
|
|
|
|
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
|
|
|
|
|
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
|
|
|
@ -508,7 +510,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
/* init cursors */
|
|
|
|
|
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
|
|
|
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
|
|
|
|
@@ -1570,6 +1750,8 @@ setup(void)
|
|
|
|
|
@@ -1570,6 +1752,8 @@ setup(void)
|
|
|
|
|
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
|
|
|
|
for (i = 0; i < LENGTH(colors); i++)
|
|
|
|
|
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
|
|
|
@ -517,7 +519,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
/* init bars */
|
|
|
|
|
updatebars();
|
|
|
|
|
updatestatus();
|
|
|
|
|
@@ -1701,7 +1883,18 @@ togglebar(const Arg *arg)
|
|
|
|
|
@@ -1701,7 +1885,18 @@ togglebar(const Arg *arg)
|
|
|
|
|
{
|
|
|
|
|
selmon->showbar = !selmon->showbar;
|
|
|
|
|
updatebarpos(selmon);
|
|
|
|
@ -537,7 +539,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
arrange(selmon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1796,11 +1989,18 @@ unmapnotify(XEvent *e)
|
|
|
|
|
@@ -1796,11 +1991,18 @@ unmapnotify(XEvent *e)
|
|
|
|
|
else
|
|
|
|
|
unmanage(c, 0);
|
|
|
|
|
}
|
|
|
|
@ -556,7 +558,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
Monitor *m;
|
|
|
|
|
XSetWindowAttributes wa = {
|
|
|
|
|
.override_redirect = True,
|
|
|
|
|
@@ -1811,10 +2011,15 @@ updatebars(void)
|
|
|
|
|
@@ -1811,10 +2013,15 @@ updatebars(void)
|
|
|
|
|
for (m = mons; m; m = m->next) {
|
|
|
|
|
if (m->barwin)
|
|
|
|
|
continue;
|
|
|
|
@ -573,7 +575,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
XMapRaised(dpy, m->barwin);
|
|
|
|
|
XSetClassHint(dpy, m->barwin, &ch);
|
|
|
|
|
}
|
|
|
|
|
@@ -1990,6 +2195,125 @@ updatestatus(void)
|
|
|
|
|
@@ -1990,6 +2197,125 @@ updatestatus(void)
|
|
|
|
|
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
|
|
|
|
strcpy(stext, "dwm-"VERSION);
|
|
|
|
|
drawbar(selmon);
|
|
|
|
@ -699,7 +701,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@@ -2057,6 +2381,16 @@ wintoclient(Window w)
|
|
|
|
|
@@ -2057,6 +2383,16 @@ wintoclient(Window w)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -716,7 +718,7 @@ index 4465af1..7f3cc51 100644
|
|
|
|
|
Monitor *
|
|
|
|
|
wintomon(Window w)
|
|
|
|
|
{
|
|
|
|
|
@@ -2110,6 +2444,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
|
|
|
|
@@ -2110,6 +2446,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|