Hi! The freshly released dwm-mitch 3.0 (updated to dwm 4.3 and dmenu 3.2, see [1]) contains a new patch called "floatborder" which allows different border sizes for floating and non-floating clients. I normally don't use any borders at all, but this patch makes it a lot easier to spot small grey floating dialog boxes in front of big grey application windows :-)
I took my patch from dwm-mitch and reapplied it to plain dwm 4.3. It compiles, but I have not tested it at all. Perhaps somebody finds this useful. The patch is attached. Regards, Christian [1] http://www.cgarbs.de/dwm-mitch.en.html -- ....Christian.Garbs.....................................http://www.cgarbs.de "Actually, I consider sendmail.cf to be object code." -- Eric Allman, 10-9-1999
diff -Narup dwm-4.3.orig/client.c dwm-4.3/client.c
--- dwm-4.3.orig/client.c 2007-07-22 10:46:00.000000000 +0200
+++ dwm-4.3/client.c 2007-07-22 10:48:52.000000000 +0200
@@ -178,11 +178,28 @@ killclient(const char *arg) {
}
void
+setborderbyfloat(Client *c, Bool configurewindow) {
+ XWindowChanges wc;
+ unsigned int newborder;
+
+ newborder = ((c->isfloating && ! c->ismax) || lt->arrange == floating) ? FLOATBORDERPX : BORDERPX;
+ if (c->border == newborder)
+ return;
+
+ c->border = newborder;
+
+ if (! configurewindow)
+ return;
+ wc.border_width = c->border;
+ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
+ configure(c);
+}
+
+void
manage(Window w, XWindowAttributes *wa) {
Client *c, *t = NULL;
Window trans;
Status rettrans;
- XWindowChanges wc;
c = emallocz(sizeof(Client));
c->tags = emallocz(ntags * sizeof(Bool));
@@ -208,10 +225,7 @@ manage(Window w, XWindowAttributes *wa)
c->y = way;
c->border = BORDERPX;
}
- wc.border_width = c->border;
- XConfigureWindow(dpy, w, CWBorderWidth, &wc);
XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
- configure(c); /* propagates border_width, if size doesn't change */
updatesizehints(c);
XSelectInput(dpy, w,
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
@@ -222,6 +236,7 @@ manage(Window w, XWindowAttributes *wa)
settags(c, t);
if(!c->isfloating)
c->isfloating = (rettrans == Success) || c->isfixed;
+ setborderbyfloat(c, True);
attach(c);
attachstack(c);
ban(c);
@@ -285,6 +300,7 @@ resize(Client *c, int x, int y, int w, i
if(y + h + 2 * c->border < sy)
y = sy;
if(c->x != x || c->y != y || c->w != w || c->h != h) {
+ setborderbyfloat(c, False);
c->x = wc.x = x;
c->y = wc.y = y;
c->w = wc.width = w;
@@ -301,6 +317,7 @@ togglefloating(const char *arg) {
if(!sel || lt->arrange == floating)
return;
sel->isfloating = !sel->isfloating;
+ setborderbyfloat(sel, True);
if(sel->isfloating)
resize(sel, sel->x, sel->y, sel->w, sel->h, True);
lt->arrange();
diff -Narup dwm-4.3.orig/config.default.h dwm-4.3/config.default.h
--- dwm-4.3.orig/config.default.h 2007-07-22 10:46:00.000000000 +0200
+++ dwm-4.3/config.default.h 2007-07-22 10:46:09.000000000 +0200
@@ -3,6 +3,7 @@
/* appearance */
#define BARPOS BarTop /* BarBot, BarOff */
#define BORDERPX 1
+#define FLOATBORDERPX 1
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
#define NORMBORDERCOLOR "#dddddd"
#define NORMBGCOLOR "#eeeeee"
diff -Narup dwm-4.3.orig/dwm.h dwm-4.3/dwm.h
--- dwm-4.3.orig/dwm.h 2007-07-22 10:46:00.000000000 +0200
+++ dwm-4.3/dwm.h 2007-07-22 10:46:09.000000000 +0200
@@ -104,6 +104,7 @@ void killclient(const char *arg); /* kil
void manage(Window w, XWindowAttributes *wa); /* manage new client */
void resize(Client *c, int x, int y,
int w, int h, Bool sizehints); /* resize with given coordinates c*/
+void setborderbyfloat(Client *c, Bool configurewindow); /* set border of client */
void togglefloating(const char *arg); /* toggles sel between floating/tiled state */
void unban(Client *c); /* unbans c */
void unmanage(Client *c); /* destroy c */
diff -Narup dwm-4.3.orig/layout.c dwm-4.3/layout.c
--- dwm-4.3.orig/layout.c 2007-07-22 10:46:00.000000000 +0200
+++ dwm-4.3/layout.c 2007-07-22 10:47:59.000000000 +0200
@@ -32,6 +32,7 @@ tile(void) {
c->ismax = False;
nx = wax;
ny = way;
+ setborderbyfloat(c, False);
if(i < nmaster) {
ny += i * mh;
nw = mw - 2 * c->border;
signature.asc
Description: Digital signature
