Refactoring alpha-systray patch ref. #37

pull/74/head
bakkeby 3 years ago
parent cf91903524
commit e8db783d7e

@ -277,5 +277,5 @@ index 4c67419..4f66f0d 100644
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
--
2.32.0
2.33.0

@ -1,4 +1,4 @@
From 2ac70783ffc856e62fe8878fc48f5417319eae93 Mon Sep 17 00:00:00 2001
From 47b8212ca25931d4d23b61b77f9a7d1c3d7f5f18 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 10:53:35 +0200
Subject: [PATCH 2/2] Adding systray patch
@ -6,8 +6,8 @@ Subject: [PATCH 2/2] Adding systray patch
Refer to https://dwm.suckless.org/patches/systray/
---
config.def.h | 4 +
dwm.c | 427 +++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 405 insertions(+), 26 deletions(-)
dwm.c | 423 +++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 400 insertions(+), 27 deletions(-)
diff --git a/config.def.h b/config.def.h
index 4f68fe8..1952613 100644
@ -25,7 +25,7 @@ index 4f68fe8..1952613 100644
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
diff --git a/dwm.c b/dwm.c
index 20f8309..12dfa04 100644
index 20f8309..c0643aa 100644
--- a/dwm.c
+++ b/dwm.c
@@ -59,12 +59,30 @@
@ -171,7 +171,7 @@ index 20f8309..12dfa04 100644
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
@@ -520,9 +564,54 @@ cleanupmon(Monitor *mon)
@@ -520,9 +564,53 @@ cleanupmon(Monitor *mon)
void
clientmessage(XEvent *e)
{
@ -217,7 +217,6 @@ index 20f8309..12dfa04 100644
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ XSync(dpy, False);
+ setclientstate(c, NormalState);
+ drawbar(selmon);
+ updatesystray();
+ }
+ return;
@ -226,7 +225,7 @@ index 20f8309..12dfa04 100644
if (!c)
return;
if (cme->message_type == netatom[NetWMState]) {
@@ -660,6 +749,10 @@ destroynotify(XEvent *e)
@@ -660,6 +748,10 @@ destroynotify(XEvent *e)
if ((c = wintoclient(ev->window)))
unmanage(c, 1);
@ -237,7 +236,7 @@ index 20f8309..12dfa04 100644
}
void
@@ -703,17 +796,20 @@ dirtomon(int dir)
@@ -703,17 +795,20 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
@ -260,7 +259,7 @@ index 20f8309..12dfa04 100644
}
for (c = m->clients; c; c = c->next) {
@@ -736,7 +832,7 @@ drawbar(Monitor *m)
@@ -736,7 +831,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@ -269,7 +268,7 @@ index 20f8309..12dfa04 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);
@@ -747,7 +843,7 @@ drawbar(Monitor *m)
@@ -747,7 +842,7 @@ drawbar(Monitor *m)
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
@ -278,39 +277,22 @@ index 20f8309..12dfa04 100644
}
void
@@ -755,8 +851,18 @@ drawbars(void)
{
Monitor *m;
+ if (showsystray) {
+ /* Clear status bar to avoid artifacts beneath systray icons */
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, 0, 0, selmon->ww, bh, 1, 1);
+ drw_map(drw, selmon->barwin, 0, 0, selmon->ww, bh);
+ }
+
for (m = mons; m; m = m->next)
drawbar(m);
+
+ if (showsystray)
+ updatesystray();
}
void
@@ -784,8 +890,11 @@ expose(XEvent *e)
@@ -784,8 +879,12 @@ expose(XEvent *e)
Monitor *m;
XExposeEvent *ev = &e->xexpose;
- if (ev->count == 0 && (m = wintomon(ev->window)))
- drawbar(m);
+ if (ev->count == 0 && (m = wintomon(ev->window))) {
drawbar(m);
+ if (showsystray && m == selmon)
+ updatesystray();
+ else
+ drawbar(m);
+ }
}
void
@@ -871,9 +980,17 @@ getatomprop(Client *c, Atom prop)
@@ -871,9 +970,17 @@ getatomprop(Client *c, Atom prop)
unsigned char *p = NULL;
Atom da, atom = None;
@ -329,7 +311,7 @@ index 20f8309..12dfa04 100644
XFree(p);
}
return atom;
@@ -907,6 +1024,16 @@ getstate(Window w)
@@ -907,6 +1014,16 @@ getstate(Window w)
return result;
}
@ -346,7 +328,7 @@ index 20f8309..12dfa04 100644
int
gettextprop(Window w, Atom atom, char *text, unsigned int size)
{
@@ -1011,7 +1138,7 @@ killclient(const Arg *arg)
@@ -1011,7 +1128,7 @@ killclient(const Arg *arg)
{
if (!selmon->sel)
return;
@ -355,7 +337,7 @@ index 20f8309..12dfa04 100644
XGrabServer(dpy);
XSetErrorHandler(xerrordummy);
XSetCloseDownMode(dpy, DestroyAll);
@@ -1100,6 +1227,12 @@ maprequest(XEvent *e)
@@ -1100,6 +1217,12 @@ maprequest(XEvent *e)
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
@ -368,7 +350,7 @@ index 20f8309..12dfa04 100644
if (!XGetWindowAttributes(dpy, ev->window, &wa))
return;
if (wa.override_redirect)
@@ -1223,6 +1356,16 @@ propertynotify(XEvent *e)
@@ -1223,6 +1346,16 @@ propertynotify(XEvent *e)
Window trans;
XPropertyEvent *ev = &e->xproperty;
@ -385,7 +367,7 @@ index 20f8309..12dfa04 100644
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
updatestatus();
else if (ev->state == PropertyDelete)
@@ -1273,6 +1416,19 @@ recttomon(int x, int y, int w, int h)
@@ -1273,6 +1406,19 @@ recttomon(int x, int y, int w, int h)
return r;
}
@ -405,7 +387,7 @@ index 20f8309..12dfa04 100644
void
resize(Client *c, int x, int y, int w, int h, int interact)
{
@@ -1352,6 +1508,18 @@ resizemouse(const Arg *arg)
@@ -1352,6 +1498,18 @@ resizemouse(const Arg *arg)
}
}
@ -424,7 +406,7 @@ index 20f8309..12dfa04 100644
void
restack(Monitor *m)
{
@@ -1441,26 +1609,35 @@ setclientstate(Client *c, long state)
@@ -1441,26 +1599,35 @@ setclientstate(Client *c, long state)
}
int
@ -471,7 +453,7 @@ index 20f8309..12dfa04 100644
}
return exists;
}
@@ -1474,7 +1651,7 @@ setfocus(Client *c)
@@ -1474,7 +1641,7 @@ setfocus(Client *c)
XA_WINDOW, 32, PropModeReplace,
(unsigned char *) &(c->win), 1);
}
@ -480,7 +462,7 @@ index 20f8309..12dfa04 100644
}
void
@@ -1564,13 +1741,22 @@ setup(void)
@@ -1564,13 +1731,22 @@ 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);
@ -503,7 +485,7 @@ index 20f8309..12dfa04 100644
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1579,6 +1765,9 @@ setup(void)
@@ -1579,6 +1755,9 @@ setup(void)
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
@ -513,7 +495,7 @@ index 20f8309..12dfa04 100644
/* init bars */
updatebars();
updatestatus();
@@ -1661,6 +1850,22 @@ spawn(const Arg *arg)
@@ -1661,6 +1840,22 @@ spawn(const Arg *arg)
}
}
@ -536,7 +518,7 @@ index 20f8309..12dfa04 100644
void
tag(const Arg *arg)
{
@@ -1711,6 +1916,23 @@ togglebar(const Arg *arg)
@@ -1711,6 +1906,23 @@ togglebar(const Arg *arg)
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
@ -560,7 +542,7 @@ index 20f8309..12dfa04 100644
arrange(selmon);
}
@@ -1804,12 +2026,18 @@ unmapnotify(XEvent *e)
@@ -1804,12 +2016,18 @@ unmapnotify(XEvent *e)
setclientstate(c, WithdrawnState);
else
unmanage(c, 0);
@ -579,7 +561,7 @@ index 20f8309..12dfa04 100644
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
@@ -1822,10 +2050,15 @@ updatebars(void)
@@ -1822,10 +2040,15 @@ updatebars(void)
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
@ -596,7 +578,7 @@ index 20f8309..12dfa04 100644
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
}
@@ -2001,6 +2234,138 @@ updatestatus(void)
@@ -2001,6 +2224,142 @@ updatestatus(void)
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
drawbar(selmon);
@ -654,7 +636,11 @@ index 20f8309..12dfa04 100644
+ }
+ }
+
+ /* Clear status bar to avoid artifacts beneath systray icons */
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, 0, 0, selmon->ww, bh, 1, 1);
+ drw_map(drw, selmon->barwin, 0, 0, selmon->ww, bh);
+
+ for (w = 0, i = systray->icons; i; i = i->next) {
+ wa.background_pixel = 0;
+ XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
@ -735,7 +721,7 @@ index 20f8309..12dfa04 100644
}
void
@@ -2085,6 +2450,16 @@ wintomon(Window w)
@@ -2085,6 +2444,16 @@ wintomon(Window w)
return selmon;
}

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
From 309128900da962d6f46030fa2975c50b76cd2895 Mon Sep 17 00:00:00 2001
From fbb66e4a6d703247979b8c2a6718aa8f0265804f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 15:57:24 +0200
Subject: [PATCH 2/2] Adding taggrid module

@ -1,6 +1,6 @@
From fd2e8fbc859d688521e50d98d5c47d1f98657afb Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 12:33:04 +0200
Date: Tue, 7 Apr 2020 12.19.14 +0200
Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW
By default, dwm response to client requests to _NET_ACTIVE_WINDOW client

@ -155,5 +155,5 @@ index 5e4d494..253bc06 100644
tag(const Arg *arg)
{
--
2.33.0
2.19.1

@ -44,5 +44,5 @@ index 7186040..0e4b4ee 100644
}
--
2.32.0
2.33.0

@ -48,5 +48,5 @@ index eafe28a..7fcd53c 100644
ce.height = wc.height = h;
ce.type = ConfigureNotify;
--
2.32.0
2.33.0

@ -23,5 +23,5 @@ index eafe28a..52039eb 100644
d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
--
2.32.0
2.33.0

Loading…
Cancel
Save