sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 4fe712170b4169371f0e6f63caa51edf2a05f594
parent 692e2dc3c04eb629fa636178718b61e10fdb21fd
Author: Gunther Klessinger <gunther.klessinger@axiros.com>
Date:   Thu,  1 Jul 2021 10:09:41 +0200

fix: Panel was involved in the focusstack loop of clients

With the new version of the patch we ignore it on mod+j / mod+k.

Diffstat:
Ddwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210611-67d76bd.diff | 123-------------------------------------------------------------------------------
Adwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210701-67d76bd.diff | 130+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/xfce4-panel/index.md | 11+++++------
3 files changed, 135 insertions(+), 129 deletions(-)

diff --git a/dwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210611-67d76bd.diff b/dwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210611-67d76bd.diff @@ -1,123 +0,0 @@ -From 7a9b83d0d74f9aca800c1ec0d2e698449c166e86 Mon Sep 17 00:00:00 2001 -From: Gunther Klessinger <gunther.klessinger@axiros.com> -Date: Fri, 11 Jun 2021 21:54:29 +0200 -Subject: [PATCH] Supporting xfce4-panel in dwm - -We treat the panel as special window which -- never has borders -- never has focus -- always has y=0 -- is never shown as active window in the indicators -- is shown on all tags (via config rule) - -Which window? "xfce4-panel" - configurable in config.h - -=> Might work for other panels as well, if you adapt. ---- - config.def.h | 2 ++ - dwm.c | 27 ++++++++++++++++++++------- - 2 files changed, 22 insertions(+), 7 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..3b9e7d6 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -3,6 +3,7 @@ - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -+static const char panel[][20] = { "xfce4-panel", "Xfce4-panel" }; /* name & cls of panel win */ - 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" }; -@@ -29,6 +30,7 @@ static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, -+ { panel[1], NULL, NULL, (1 << 9) - 1, 0, -1 }, - }; - - /* layout(s) */ -diff --git a/dwm.c b/dwm.c -index b0b3466..a3b618b 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -175,6 +175,7 @@ static long getstate(Window w); - static int gettextprop(Window w, Atom atom, char *text, unsigned int size); - static void grabbuttons(Client *c, int focused); - static void grabkeys(void); -+static int ispanel(Client *c); - static void incnmaster(const Arg *arg); - static void keypress(XEvent *e); - static void killclient(const Arg *arg); -@@ -710,6 +711,8 @@ drawbar(Monitor *m) - } - - for (c = m->clients; c; c = c->next) { -+ // prevent showing the panel as active application: -+ if (ispanel(c)) continue; - occ |= c->tags; - if (c->isurgent) - urg |= c->tags; -@@ -793,11 +796,14 @@ focus(Client *c) - selmon = c->mon; - if (c->isurgent) - seturgent(c, 0); -- detachstack(c); -- attachstack(c); -- grabbuttons(c, 1); -- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); -- setfocus(c); -+ // prevents the panel getting focus when tag switching: -+ if (!ispanel(c)) { -+ detachstack(c); -+ attachstack(c); -+ grabbuttons(c, 1); -+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); -+ setfocus(c); -+ } - } else { - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - XDeleteProperty(dpy, root, netatom[NetActiveWindow]); -@@ -964,6 +970,11 @@ grabkeys(void) - } - } - -+int -+ispanel(Client *c) { -+ return !strcmp(c->name, panel[0]); -+} -+ - void - incnmaster(const Arg *arg) - { -@@ -1049,7 +1060,8 @@ manage(Window w, XWindowAttributes *wa) - c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) - && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); - c->bw = borderpx; -- -+ // no border - even when active -+ if (ispanel(c)) c->bw = c->oldbw = 0; - wc.border_width = c->bw; - XConfigureWindow(dpy, w, CWBorderWidth, &wc); - XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); -@@ -1283,6 +1295,7 @@ resizeclient(Client *c, int x, int y, int w, int h) - c->oldw = c->w; c->w = wc.width = w; - c->oldh = c->h; c->h = wc.height = h; - wc.border_width = c->bw; -+ if (ispanel(c)) c->y = c->oldy = c->bw = wc.y = wc.border_width = 0; - XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); - configure(c); - XSync(dpy, False); -@@ -1991,7 +2004,7 @@ void - updatestatus(void) - { - if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) -- strcpy(stext, "dwm-"VERSION); -+ strcpy(stext, " "); // no shining of dwm version thru panel, when transparent - drawbar(selmon); - } - --- -2.31.1 - diff --git a/dwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210701-67d76bd.diff b/dwm.suckless.org/patches/xfce4-panel/dwm-xfce4-panel-20210701-67d76bd.diff @@ -0,0 +1,130 @@ +From 4e33fe0d465fb24f6b42d4a1fb63d4d7902f1986 Mon Sep 17 00:00:00 2001 +From: Gunther Klessinger <gunther.klessinger@axiros.com> +Date: Thu, 1 Jul 2021 09:19:07 +0200 +Subject: [PATCH] Supporting xfce4-panel in dwm + +We treat the panel as special window which +- never has borders +- never has focus +- always has y=0 +- is never shown as active window in the indicators +- is shown on all tags (via config rule) +- is ignored on focusstack (MOD+j, MOD+k) + +Which window? "xfce4-panel" - configurable in config.h +--- + config.def.h | 2 ++ + dwm.c | 28 +++++++++++++++++++++------- + 2 files changed, 23 insertions(+), 7 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..3b9e7d6 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -3,6 +3,7 @@ + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ + static const unsigned int snap = 32; /* snap pixel */ ++static const char panel[][20] = { "xfce4-panel", "Xfce4-panel" }; /* name & cls of panel win */ + 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" }; +@@ -29,6 +30,7 @@ static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, 1, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ { panel[1], NULL, NULL, (1 << 9) - 1, 0, -1 }, + }; + + /* layout(s) */ +diff --git a/dwm.c b/dwm.c +index b0b3466..956d402 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -175,6 +175,7 @@ static long getstate(Window w); + static int gettextprop(Window w, Atom atom, char *text, unsigned int size); + static void grabbuttons(Client *c, int focused); + static void grabkeys(void); ++static int ispanel(Client *c); + static void incnmaster(const Arg *arg); + static void keypress(XEvent *e); + static void killclient(const Arg *arg); +@@ -710,6 +711,8 @@ drawbar(Monitor *m) + } + + for (c = m->clients; c; c = c->next) { ++ // prevent showing the panel as active application: ++ if (ispanel(c)) continue; + occ |= c->tags; + if (c->isurgent) + urg |= c->tags; +@@ -793,11 +796,14 @@ focus(Client *c) + selmon = c->mon; + if (c->isurgent) + seturgent(c, 0); +- detachstack(c); +- attachstack(c); +- grabbuttons(c, 1); +- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); +- setfocus(c); ++ // prevents the panel getting focus when tag switching: ++ if (!ispanel(c)) { ++ detachstack(c); ++ attachstack(c); ++ grabbuttons(c, 1); ++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ setfocus(c); ++ } + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +@@ -853,6 +859,7 @@ focusstack(const Arg *arg) + if (c) { + focus(c); + restack(selmon); ++ if (ispanel(c)) focusstack(arg); + } + } + +@@ -964,6 +971,11 @@ grabkeys(void) + } + } + ++int ++ispanel(Client *c) { ++ return !strcmp(c->name, panel[0]); ++} ++ + void + incnmaster(const Arg *arg) + { +@@ -1049,7 +1061,8 @@ manage(Window w, XWindowAttributes *wa) + c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); + c->bw = borderpx; +- ++ // no border - even when active ++ if (ispanel(c)) c->bw = c->oldbw = 0; + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); +@@ -1283,6 +1296,7 @@ resizeclient(Client *c, int x, int y, int w, int h) + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ if (ispanel(c)) c->y = c->oldy = c->bw = wc.y = wc.border_width = 0; + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +@@ -1991,7 +2005,7 @@ void + updatestatus(void) + { + if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) +- strcpy(stext, "dwm-"VERSION); ++ strcpy(stext, " "); // no shining of dwm version thru panel, when transparent + drawbar(selmon); + } + +-- +2.31.1 + diff --git a/dwm.suckless.org/patches/xfce4-panel/index.md b/dwm.suckless.org/patches/xfce4-panel/index.md @@ -13,26 +13,25 @@ as a status bar, i.e.: - always has y=0 - it is never shown as active window in the tag indicators - it is shown on all tags (via a tag rule in the config) +- it is ignored on `focusstack` (MOD+j / MOD+k) ![dwm_xfce4-panel.png](dwm_xfce4-panel.png) - The panel does act as systray for third party tools, i.e. the systray patch is no more required -- Looks best when background is set to solid color, same as the dwm statusline (black in the example) +- Looks best when background is set to same color as the dwm statusline (black in the example) - Using a compositor you can dimm or completely hide it, when not hovered -The patch has been created against dwm6.2. - +The patch has been created against dwm6.2. Download -------- -* [dwm-xfce4-panel-20210611-67d76bd.diff](dwm-xfce4-panel-20210611-67d76bd.diff) (2021-06-11) - +* [dwm-xfce4-panel-20210701-67d76bd.diff](dwm-xfce4-panel-20210701-67d76bd.diff) (2021-07-01) Notes ----- -- The workspace switcher won't work interactively, but dwm's interactive tag indicators remain on the left anyway. +- The workspace switcher won't work interactively, but dwm's interactive tag indicators remain on the left anyway. - Some actions in the "session menu" applet (the one with your name as title) won't work out of the box. You might supply your own sub menu or modify the actions of the existing one. - The rest of xfce4's 40 or so panel apps _should_ work (if installed) and also custom "applets" (see below) are working - Startup: A start via xinitrc should be fine. I use the [autostart](https://dwm.suckless.org/patches/autostart/) patch to start