added new patch

This commit is contained in:
hellisabove
2021-10-18 17:45:03 +03:00
parent baddb891d1
commit 7f3d2386b7
7 changed files with 192 additions and 18 deletions
+1
View File
@@ -35,6 +35,7 @@ static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
{ panel[1], NULL, NULL, (1 << 9) - 1, 0, -1 },
}; };
/* layout(s) */ /* layout(s) */
+4
View File
@@ -2,6 +2,7 @@
/* appearance */ /* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappx = 5; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */ 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 systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
@@ -89,6 +90,9 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY, XK_minus, setgaps, {.i = -1 } },
{ MODKEY, XK_equal, setgaps, {.i = +1 } },
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1) TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2) TAGKEYS( XK_3, 2)
+10
View File
@@ -0,0 +1,10 @@
--- config.def.h
+++ 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" };
+5 -3
View File
@@ -10,7 +10,8 @@ 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 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 const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const char panel[][20] = { "xfce4-panel", "Xfce4-panel" }; /* name & cls of panel win */
static const char *fonts[] = { "monospace:size=12", "fontawesome:size=12" }; static const char *fonts[] = { "monospace:size=12", "fontawesome:size=12" };
static const char dmenufont[] = "monospace:size=11"; static const char dmenufont[] = "monospace:size=11";
//background color //background color
@@ -30,7 +31,7 @@ static const char *colors[][3] = {
}; };
/* tagging */ /* tagging */
//tag names (upper left) //tag names (upper left)
static const char *tags[] = { "", "", "", "", "", "", "", "", "", "" }; static const char *tags[] = { "1", "2", "3", "4", "5" };
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
@@ -40,6 +41,7 @@ static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
{ panel[1], NULL, NULL, (1 << 9) - 1, 0, -1 },
}; };
@@ -67,7 +69,7 @@ static const Layout layouts[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL}; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
//sets st as the default terminal //sets st as the default terminal
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
////volume controls ////volume controls
+130
View File
@@ -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
+21 -7
View File
@@ -200,6 +200,7 @@ static unsigned int getsystraywidth();
static int gettextprop(Window w, Atom atom, char *text, unsigned int size); static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused); static void grabbuttons(Client *c, int focused);
static void grabkeys(void); static void grabkeys(void);
static int ispanel(Client *c);
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
static void keypress(XEvent *e); static void keypress(XEvent *e);
static void killclient(const Arg *arg); static void killclient(const Arg *arg);
@@ -808,6 +809,8 @@ drawbar(Monitor *m)
} }
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
// prevent showing the panel as active application:
if (ispanel(c)) continue;
occ |= c->tags; occ |= c->tags;
if (c->isurgent) if (c->isurgent)
urg |= c->tags; urg |= c->tags;
@@ -894,11 +897,14 @@ focus(Client *c)
selmon = c->mon; selmon = c->mon;
if (c->isurgent) if (c->isurgent)
seturgent(c, 0); seturgent(c, 0);
detachstack(c); // prevents the panel getting focus when tag switching:
attachstack(c); if (!ispanel(c)) {
grabbuttons(c, 1); detachstack(c);
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); attachstack(c);
setfocus(c); grabbuttons(c, 1);
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
setfocus(c);
}
} else { } else {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]); XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
@@ -954,6 +960,7 @@ focusstack(const Arg *arg)
if (c) { if (c) {
focus(c); focus(c);
restack(selmon); restack(selmon);
if (ispanel(c)) focusstack(arg);
} }
} }
@@ -1082,6 +1089,11 @@ grabkeys(void)
} }
} }
int
ispanel(Client *c) {
return !strcmp(c->name, panel[0]);
}
void void
incnmaster(const Arg *arg) incnmaster(const Arg *arg)
{ {
@@ -1167,7 +1179,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->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->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
c->bw = borderpx; c->bw = borderpx;
// no border - even when active
if (ispanel(c)) c->bw = c->oldbw = 0;
wc.border_width = c->bw; wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc); XConfigureWindow(dpy, w, CWBorderWidth, &wc);
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
@@ -1439,6 +1452,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldw = c->w; c->w = wc.width = w; c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h; c->oldh = c->h; c->h = wc.height = h;
wc.border_width = c->bw; 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); XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c); configure(c);
XSync(dpy, False); XSync(dpy, False);
@@ -2210,7 +2224,7 @@ void
updatestatus(void) updatestatus(void)
{ {
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) 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); drawbar(selmon);
updatesystray(); updatesystray();
} }
+21 -8
View File
@@ -137,6 +137,7 @@ struct Monitor {
int by; /* bar geometry */ int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */ int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */ int wx, wy, ww, wh; /* window area */
int gappx; /* gaps between windows */
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
unsigned int tagset[2]; unsigned int tagset[2];
@@ -227,6 +228,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state); static void setclientstate(Client *c, long state);
static void setfocus(Client *c); static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
@@ -726,6 +728,7 @@ createmon(void)
m->nmaster = nmaster; m->nmaster = nmaster;
m->showbar = showbar; m->showbar = showbar;
m->topbar = topbar; m->topbar = topbar;
m->gappx = gappx;
m->lt[0] = &layouts[0]; m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)]; m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1674,6 +1677,16 @@ setfullscreen(Client *c, int fullscreen)
} }
} }
void
setgaps(const Arg *arg)
{
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
selmon->gappx = 0;
else
selmon->gappx += arg->i;
arrange(selmon);
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@@ -1869,16 +1882,16 @@ tile(Monitor *m)
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0; mw = m->nmaster ? m->ww * m->mfact : 0;
else else
mw = m->ww; mw = m->ww - m->gappx;
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) { if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i); h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
my += HEIGHT(c); my += HEIGHT(c) + m->gappx;
} else { } else {
h = (m->wh - ty) / (n - i); h = (m->wh - ty) / (n - i) - m->gappx;
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
ty += HEIGHT(c); ty += HEIGHT(c) + m->gappx;
} }
} }