flexwintitle: allow flexwintitle to control window borders

This commit is contained in:
bakkeby 2020-08-27 21:37:19 +02:00
parent d8ebab4f75
commit 0d743eddff
3 changed files with 45 additions and 36 deletions

View File

@ -226,39 +226,39 @@ static char *colors[][ColCount] = {
[SchemeHid] = { hidfgcolor, hidbgcolor, hidbordercolor, hidfloatcolor }, [SchemeHid] = { hidfgcolor, hidbgcolor, hidbordercolor, hidfloatcolor },
[SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor }, [SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor },
#if BAR_FLEXWINTITLE_PATCH #if BAR_FLEXWINTITLE_PATCH
[SchemeFlexActTTB] = { titleselfgcolor, actTTBbgcolor, c000000, c000000 }, [SchemeFlexActTTB] = { titleselfgcolor, actTTBbgcolor, actTTBbgcolor, c000000 },
[SchemeFlexActLTR] = { titleselfgcolor, actLTRbgcolor, c000000, c000000 }, [SchemeFlexActLTR] = { titleselfgcolor, actLTRbgcolor, actLTRbgcolor, c000000 },
[SchemeFlexActMONO] = { titleselfgcolor, actMONObgcolor, c000000, c000000 }, [SchemeFlexActMONO] = { titleselfgcolor, actMONObgcolor, actMONObgcolor, c000000 },
[SchemeFlexActGRID] = { titleselfgcolor, actGRIDbgcolor, c000000, c000000 }, [SchemeFlexActGRID] = { titleselfgcolor, actGRIDbgcolor, actGRIDbgcolor, c000000 },
[SchemeFlexActGRD1] = { titleselfgcolor, actGRD1bgcolor, c000000, c000000 }, [SchemeFlexActGRD1] = { titleselfgcolor, actGRD1bgcolor, actGRD1bgcolor, c000000 },
[SchemeFlexActGRD2] = { titleselfgcolor, actGRD2bgcolor, c000000, c000000 }, [SchemeFlexActGRD2] = { titleselfgcolor, actGRD2bgcolor, actGRD2bgcolor, c000000 },
[SchemeFlexActGRDM] = { titleselfgcolor, actGRDMbgcolor, c000000, c000000 }, [SchemeFlexActGRDM] = { titleselfgcolor, actGRDMbgcolor, actGRDMbgcolor, c000000 },
[SchemeFlexActHGRD] = { titleselfgcolor, actHGRDbgcolor, c000000, c000000 }, [SchemeFlexActHGRD] = { titleselfgcolor, actHGRDbgcolor, actHGRDbgcolor, c000000 },
[SchemeFlexActDWDL] = { titleselfgcolor, actDWDLbgcolor, c000000, c000000 }, [SchemeFlexActDWDL] = { titleselfgcolor, actDWDLbgcolor, actDWDLbgcolor, c000000 },
[SchemeFlexActSPRL] = { titleselfgcolor, actSPRLbgcolor, c000000, c000000 }, [SchemeFlexActSPRL] = { titleselfgcolor, actSPRLbgcolor, actSPRLbgcolor, c000000 },
[SchemeFlexActFloat] = { titleselfgcolor, actfloatbgcolor, c000000, c000000 }, [SchemeFlexActFloat] = { titleselfgcolor, actfloatbgcolor, actfloatbgcolor, c000000 },
[SchemeFlexInaTTB] = { titlenormfgcolor, normTTBbgcolor, c000000, c000000 }, [SchemeFlexInaTTB] = { titlenormfgcolor, normTTBbgcolor, normTTBbgcolor, c000000 },
[SchemeFlexInaLTR] = { titlenormfgcolor, normLTRbgcolor, c000000, c000000 }, [SchemeFlexInaLTR] = { titlenormfgcolor, normLTRbgcolor, normLTRbgcolor, c000000 },
[SchemeFlexInaMONO] = { titlenormfgcolor, normMONObgcolor, c000000, c000000 }, [SchemeFlexInaMONO] = { titlenormfgcolor, normMONObgcolor, normMONObgcolor, c000000 },
[SchemeFlexInaGRID] = { titlenormfgcolor, normGRIDbgcolor, c000000, c000000 }, [SchemeFlexInaGRID] = { titlenormfgcolor, normGRIDbgcolor, normGRIDbgcolor, c000000 },
[SchemeFlexInaGRD1] = { titlenormfgcolor, normGRD1bgcolor, c000000, c000000 }, [SchemeFlexInaGRD1] = { titlenormfgcolor, normGRD1bgcolor, normGRD1bgcolor, c000000 },
[SchemeFlexInaGRD2] = { titlenormfgcolor, normGRD2bgcolor, c000000, c000000 }, [SchemeFlexInaGRD2] = { titlenormfgcolor, normGRD2bgcolor, normGRD2bgcolor, c000000 },
[SchemeFlexInaGRDM] = { titlenormfgcolor, normGRDMbgcolor, c000000, c000000 }, [SchemeFlexInaGRDM] = { titlenormfgcolor, normGRDMbgcolor, normGRDMbgcolor, c000000 },
[SchemeFlexInaHGRD] = { titlenormfgcolor, normHGRDbgcolor, c000000, c000000 }, [SchemeFlexInaHGRD] = { titlenormfgcolor, normHGRDbgcolor, normHGRDbgcolor, c000000 },
[SchemeFlexInaDWDL] = { titlenormfgcolor, normDWDLbgcolor, c000000, c000000 }, [SchemeFlexInaDWDL] = { titlenormfgcolor, normDWDLbgcolor, normDWDLbgcolor, c000000 },
[SchemeFlexInaSPRL] = { titlenormfgcolor, normSPRLbgcolor, c000000, c000000 }, [SchemeFlexInaSPRL] = { titlenormfgcolor, normSPRLbgcolor, normSPRLbgcolor, c000000 },
[SchemeFlexInaFloat] = { titlenormfgcolor, normfloatbgcolor, c000000, c000000 }, [SchemeFlexInaFloat] = { titlenormfgcolor, normfloatbgcolor, normfloatbgcolor, c000000 },
[SchemeFlexSelTTB] = { titleselfgcolor, selTTBbgcolor, c000000, c000000 }, [SchemeFlexSelTTB] = { titleselfgcolor, selTTBbgcolor, selTTBbgcolor, c000000 },
[SchemeFlexSelLTR] = { titleselfgcolor, selLTRbgcolor, c000000, c000000 }, [SchemeFlexSelLTR] = { titleselfgcolor, selLTRbgcolor, selLTRbgcolor, c000000 },
[SchemeFlexSelMONO] = { titleselfgcolor, selMONObgcolor, c000000, c000000 }, [SchemeFlexSelMONO] = { titleselfgcolor, selMONObgcolor, selMONObgcolor, c000000 },
[SchemeFlexSelGRID] = { titleselfgcolor, selGRIDbgcolor, c000000, c000000 }, [SchemeFlexSelGRID] = { titleselfgcolor, selGRIDbgcolor, selGRIDbgcolor, c000000 },
[SchemeFlexSelGRD1] = { titleselfgcolor, selGRD1bgcolor, c000000, c000000 }, [SchemeFlexSelGRD1] = { titleselfgcolor, selGRD1bgcolor, selGRD1bgcolor, c000000 },
[SchemeFlexSelGRD2] = { titleselfgcolor, selGRD2bgcolor, c000000, c000000 }, [SchemeFlexSelGRD2] = { titleselfgcolor, selGRD2bgcolor, selGRD2bgcolor, c000000 },
[SchemeFlexSelGRDM] = { titleselfgcolor, selGRDMbgcolor, c000000, c000000 }, [SchemeFlexSelGRDM] = { titleselfgcolor, selGRDMbgcolor, selGRDMbgcolor, c000000 },
[SchemeFlexSelHGRD] = { titleselfgcolor, selHGRDbgcolor, c000000, c000000 }, [SchemeFlexSelHGRD] = { titleselfgcolor, selHGRDbgcolor, selHGRDbgcolor, c000000 },
[SchemeFlexSelDWDL] = { titleselfgcolor, selDWDLbgcolor, c000000, c000000 }, [SchemeFlexSelDWDL] = { titleselfgcolor, selDWDLbgcolor, selDWDLbgcolor, c000000 },
[SchemeFlexSelSPRL] = { titleselfgcolor, selSPRLbgcolor, c000000, c000000 }, [SchemeFlexSelSPRL] = { titleselfgcolor, selSPRLbgcolor, selSPRLbgcolor, c000000 },
[SchemeFlexSelFloat] = { titleselfgcolor, selfloatbgcolor, c000000, c000000 }, [SchemeFlexSelFloat] = { titleselfgcolor, selfloatbgcolor, selfloatbgcolor, c000000 },
#endif // BAR_FLEXWINTITLE_PATCH #endif // BAR_FLEXWINTITLE_PATCH
}; };

8
dwm.c
View File

@ -1692,10 +1692,12 @@ focus(Client *c)
detachstack(c); detachstack(c);
attachstack(c); attachstack(c);
grabbuttons(c, 1); grabbuttons(c, 1);
#if !BAR_FLEXWINTITLE_PATCH
if (c->isfloating) if (c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel);
else else
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
setfocus(c); setfocus(c);
} else { } else {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
@ -2063,10 +2065,12 @@ manage(Window w, XWindowAttributes *wa)
wc.border_width = c->bw; wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc); XConfigureWindow(dpy, w, CWBorderWidth, &wc);
#if !BAR_FLEXWINTITLE_PATCH
if (c->isfloating) if (c->isfloating)
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel);
else else
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
configure(c); /* propagates border_width, if size doesn't change */ configure(c); /* propagates border_width, if size doesn't change */
#if !FLOATPOS_PATCH #if !FLOATPOS_PATCH
updatesizehints(c); updatesizehints(c);
@ -3348,10 +3352,12 @@ togglefloating(const Arg *arg)
#endif // FAKEFULLSCREEN_CLIENT_PATCH #endif // FAKEFULLSCREEN_CLIENT_PATCH
#endif // !FAKEFULLSCREEN_PATCH #endif // !FAKEFULLSCREEN_PATCH
c->isfloating = !c->isfloating || c->isfixed; c->isfloating = !c->isfloating || c->isfixed;
#if !BAR_FLEXWINTITLE_PATCH
if (c->isfloating) if (c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel);
else else
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
if (c->isfloating) { if (c->isfloating) {
#if SAVEFLOATS_PATCH || EXRESIZE_PATCH #if SAVEFLOATS_PATCH || EXRESIZE_PATCH
if (c->sfx != -9999) { if (c->sfx != -9999) {
@ -3497,10 +3503,12 @@ unfocus(Client *c, int setfocus)
#endif // FAKEFULLSCREEN_CLIENT_PATCH #endif // FAKEFULLSCREEN_CLIENT_PATCH
#endif // LOSEFULLSCREEN_PATCH #endif // LOSEFULLSCREEN_PATCH
grabbuttons(c, 0); grabbuttons(c, 0);
#if !BAR_FLEXWINTITLE_PATCH
if (c->isfloating) if (c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColFloat].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColFloat].pixel);
else else
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
if (setfocus) { if (setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]); XDeleteProperty(dpy, root, netatom[NetActiveWindow]);

View File

@ -171,8 +171,7 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar
if (!c) if (!c)
return; return;
int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2; int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2;
int clientscheme = (
drw_setscheme(drw, scheme[(
c == m->sel c == m->sel
? getselschemefor(tabscheme) ? getselschemefor(tabscheme)
: HIDDEN(c) : HIDDEN(c)
@ -180,7 +179,9 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar
: c->isurgent : c->isurgent
? SchemeUrg ? SchemeUrg
: tabscheme : tabscheme
)]); );
drw_setscheme(drw, scheme[clientscheme]);
XSetWindowBorder(dpy, c->win, scheme[clientscheme][ColBorder].pixel);
if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small
pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2); pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
#if BAR_CENTEREDWINDOWNAME_PATCH #if BAR_CENTEREDWINDOWNAME_PATCH