diff --git a/config.def.h b/config.def.h index a2ac963..e8c0978 100644 --- a/config.def.h +++ b/config.def.h @@ -26,9 +26,9 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + /* class instance title tags mask isfloating monitor float x,y,w,h floatborderpx*/ + { "Gimp", NULL, NULL, 0, 1, -1, 50,50,500,500, 5 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1, 50,50,500,500, 5 }, }; /* layout(s) */ diff --git a/dwm.c b/dwm.c index 5e4d494..a03ca15 100644 --- a/dwm.c +++ b/dwm.c @@ -93,6 +93,8 @@ struct Client { int bw, oldbw; unsigned int tags; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int floatborderpx; + int hasfloatbw; Client *next; Client *snext; Monitor *mon; @@ -139,6 +141,8 @@ typedef struct { unsigned int tags; int isfloating; int monitor; + int floatx, floaty, floatw, floath; + int floatborderpx; } Rule; /* function declarations */ @@ -300,6 +304,16 @@ applyrules(Client *c) { c->isfloating = r->isfloating; c->tags |= r->tags; + if (r->floatborderpx >= 0) { + c->floatborderpx = r->floatborderpx; + c->hasfloatbw = 1; + } + if (r->isfloating) { + if (r->floatx >= 0) c->x = c->mon->mx + r->floatx; + if (r->floaty >= 0) c->y = c->mon->my + r->floaty; + if (r->floatw >= 0) c->w = r->floatw; + if (r->floath >= 0) c->h = r->floath; + } for (m = mons; m && m->num != r->monitor; m = m->next); if (m) c->mon = m; @@ -1282,7 +1296,10 @@ resizeclient(Client *c, int x, int y, int w, int h) c->oldy = c->y; c->y = wc.y = y; c->oldw = c->w; c->w = wc.width = w; c->oldh = c->h; c->h = wc.height = h; - wc.border_width = c->bw; + if (c->isfloating && c->hasfloatbw && !c->isfullscreen) + wc.border_width = c->floatborderpx; + else + wc.border_width = c->bw; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); -- 2.32.0