sites

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

dwm-xfce4-panel-20210606-67d76bd.diff (2564B)


      1 From 19e1abe590e3fde3244cac544472741fccc881cd Mon Sep 17 00:00:00 2001
      2 From: Gunther Klessinger <gklessinger@gmx.de>
      3 Date: Sun, 6 Jun 2021 17:56:06 +0200
      4 Subject: [PATCH] Supporting xfce4-panel in dwm
      5 
      6 We basically treat the panel as special window which
      7 - never has borders
      8 - always has y=0
      9 - is never shown as active window in the indicators
     10 - is shown on all tags
     11 
     12 Which window? "xfce4-panel" - hardcoded by window name in dwm.c.
     13 => Should work for other panels as well, if you adapt.
     14 
     15 
     16 ---
     17  config.def.h |  1 +
     18  dwm.c        | 10 +++++++++-
     19  2 files changed, 10 insertions(+), 1 deletion(-)
     20 
     21 diff --git a/config.def.h b/config.def.h
     22 index 1c0b587..b772bd9 100644
     23 --- a/config.def.h
     24 +++ b/config.def.h
     25 @@ -29,6 +29,7 @@ static const Rule rules[] = {
     26  	/* class      instance    title       tags mask     isfloating   monitor */
     27  	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     28  	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     29 +	{ "Xfce4-panel",  NULL,   NULL,       (1 << 9)-1,   0,           -1 },
     30  };
     31  
     32  /* layout(s) */
     33 diff --git a/dwm.c b/dwm.c
     34 index b0b3466..5fafd62 100644
     35 --- a/dwm.c
     36 +++ b/dwm.c
     37 @@ -710,6 +710,8 @@ drawbar(Monitor *m)
     38  	}
     39  
     40  	for (c = m->clients; c; c = c->next) {
     41 +        // prevent showing the panel as active application:
     42 +        if (!strcmp(c->name, "xfce4-panel")) continue;
     43  		occ |= c->tags;
     44  		if (c->isurgent)
     45  			urg |= c->tags;
     46 @@ -1049,6 +1051,9 @@ manage(Window w, XWindowAttributes *wa)
     47  	c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
     48  		&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
     49  	c->bw = borderpx;
     50 +    // no border - even when active
     51 +    // do not match on y, does not have it yet possibly:
     52 +    if (!strcmp(c->name, "xfce4-panel")) c->bw = c->oldbw = 0;
     53  
     54  	wc.border_width = c->bw;
     55  	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
     56 @@ -1283,6 +1288,9 @@ resizeclient(Client *c, int x, int y, int w, int h)
     57  	c->oldw = c->w; c->w = wc.width = w;
     58  	c->oldh = c->h; c->h = wc.height = h;
     59  	wc.border_width = c->bw;
     60 +    if (!strcmp(c->name, "xfce4-panel")) { 
     61 +        c->y = c->oldy = c->bw = wc.y = wc.border_width = 0;
     62 +    }
     63  	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
     64  	configure(c);
     65  	XSync(dpy, False);
     66 @@ -1991,7 +1999,7 @@ void
     67  updatestatus(void)
     68  {
     69  	if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
     70 -		strcpy(stext, "dwm-"VERSION);
     71 +		strcpy(stext, " "); // no shining of dwm version thru altpanel, when transparent
     72  	drawbar(selmon);
     73  }
     74  
     75 -- 
     76 2.31.1
     77