mirror of
https://github.com/bakkeby/dwm-flexipatch
synced 2024-11-09 01:10:26 +00:00
8d754cd644
When changing colour scheme during runtime using xrdb the systray and icons would keep the original colours. To work around that the systray icon windows need to be redrawn after changing the background pixel value. Just calling XClearWindow for each systray window results in the systray icons disappearing, they do not automatically redraw. The solution is apparently to send an Expose event to each window which should in principle trigger a redraw from the application side. One way to achieve this is to move the window out of the drawable area. When the window is then brought back into view the X server will send the Expose event for the window. The "easiest" way to do this is to move the entire systray window out of view as part of the xrdb call. It is possible to do this in the draw_systray function itself, but we probably do not want to do this every single time the bar is drawn and it may also cause some noticeable flickering. This issue is isolated to using the systray without the alpha patch.
143 lines
6.0 KiB
C
143 lines
6.0 KiB
C
void
|
|
loadxrdb()
|
|
{
|
|
Display *display;
|
|
char * resm;
|
|
XrmDatabase xrdb;
|
|
char *type;
|
|
XrmValue value;
|
|
|
|
display = XOpenDisplay(NULL);
|
|
|
|
if (display != NULL) {
|
|
resm = XResourceManagerString(display);
|
|
|
|
if (resm != NULL) {
|
|
xrdb = XrmGetStringDatabase(resm);
|
|
|
|
if (xrdb != NULL) {
|
|
XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.normfloatcolor", normfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.selfloatcolor", selfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.titlenormfgcolor", titlenormfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.titlenormbgcolor", titlenormbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.titlenormbordercolor", titlenormbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.titlenormfloatcolor", titlenormfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.titleselfgcolor", titleselfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.titleselbgcolor", titleselbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.titleselbordercolor", titleselbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.titleselfloatcolor", titleselfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsnormfgcolor", tagsnormfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsnormbgcolor", tagsnormbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsnormbordercolor", tagsnormbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsnormfloatcolor", tagsnormfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsselfgcolor", tagsselfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsselbgcolor", tagsselbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsselbordercolor", tagsselbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.tagsselfloatcolor", tagsselfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.hidnormfgcolor", hidnormfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.hidnormbgcolor", hidnormbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.hidselfgcolor", hidselfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.hidselbgcolor", hidselbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.urgfgcolor", urgfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.urgbgcolor", urgbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.urgbordercolor", urgbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.urgfloatcolor", urgfloatcolor);
|
|
#if RENAMED_SCRATCHPADS_PATCH
|
|
XRDB_LOAD_COLOR("dwm.scratchselfgcolor", scratchselfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchselbgcolor", scratchselbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchselbordercolor", scratchselbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchselfloatcolor", scratchselfloatcolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchnormfgcolor", scratchnormfgcolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchnormbgcolor", scratchnormbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchnormbordercolor", scratchnormbordercolor);
|
|
XRDB_LOAD_COLOR("dwm.scratchnormfloatcolor", scratchnormfloatcolor);
|
|
#endif // RENAMED_SCRATCHPADS_PATCH
|
|
#if BAR_FLEXWINTITLE_PATCH
|
|
XRDB_LOAD_COLOR("dwm.normTTBbgcolor", normTTBbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normLTRbgcolor", normLTRbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normMONObgcolor", normMONObgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normGRIDbgcolor", normGRIDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normGRD1bgcolor", normGRD1bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normGRD2bgcolor", normGRD2bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normGRDMbgcolor", normGRDMbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normHGRDbgcolor", normHGRDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normDWDLbgcolor", normDWDLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normSPRLbgcolor", normSPRLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.normfloatbgcolor", normfloatbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actTTBbgcolor", actTTBbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actLTRbgcolor", actLTRbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actMONObgcolor", actMONObgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actGRIDbgcolor", actGRIDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actGRD1bgcolor", actGRD1bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actGRD2bgcolor", actGRD2bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actGRDMbgcolor", actGRDMbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actHGRDbgcolor", actHGRDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actDWDLbgcolor", actDWDLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actSPRLbgcolor", actSPRLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.actfloatbgcolor", actfloatbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selTTBbgcolor", selTTBbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selLTRbgcolor", selLTRbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selMONObgcolor", selMONObgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selGRIDbgcolor", selGRIDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selGRD1bgcolor", selGRD1bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selGRD2bgcolor", selGRD2bgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selGRDMbgcolor", selGRDMbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selHGRDbgcolor", selHGRDbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selDWDLbgcolor", selDWDLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selSPRLbgcolor", selSPRLbgcolor);
|
|
XRDB_LOAD_COLOR("dwm.selfloatbgcolor", selfloatbgcolor);
|
|
#endif // BAR_FLEXWINTITLE_PATCH
|
|
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH && BAR_STATUS2D_PATCH
|
|
XRDB_LOAD_COLOR("color0", termcol0);
|
|
XRDB_LOAD_COLOR("color1", termcol1);
|
|
XRDB_LOAD_COLOR("color2", termcol2);
|
|
XRDB_LOAD_COLOR("color3", termcol3);
|
|
XRDB_LOAD_COLOR("color4", termcol4);
|
|
XRDB_LOAD_COLOR("color5", termcol5);
|
|
XRDB_LOAD_COLOR("color6", termcol6);
|
|
XRDB_LOAD_COLOR("color7", termcol7);
|
|
XRDB_LOAD_COLOR("color8", termcol8);
|
|
XRDB_LOAD_COLOR("color9", termcol9);
|
|
XRDB_LOAD_COLOR("color10", termcol10);
|
|
XRDB_LOAD_COLOR("color11", termcol11);
|
|
XRDB_LOAD_COLOR("color12", termcol12);
|
|
XRDB_LOAD_COLOR("color13", termcol13);
|
|
XRDB_LOAD_COLOR("color14", termcol14);
|
|
XRDB_LOAD_COLOR("color15", termcol15);
|
|
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
|
|
|
|
XrmDestroyDatabase(xrdb);
|
|
}
|
|
}
|
|
}
|
|
|
|
XCloseDisplay(display);
|
|
}
|
|
|
|
void
|
|
xrdb(const Arg *arg)
|
|
{
|
|
loadxrdb();
|
|
int i;
|
|
for (i = 0; i < LENGTH(colors); i++)
|
|
scheme[i] = drw_scm_create(drw, colors[i],
|
|
#if BAR_ALPHA_PATCH
|
|
alphas[i],
|
|
#endif // BAR_ALPHA_PATCH
|
|
ColCount
|
|
);
|
|
#if BAR_SYSTRAY_PATCH && !BAR_ALPHA_PATCH
|
|
if (systray) {
|
|
XMoveWindow(dpy, systray->win, -32000, -32000);
|
|
}
|
|
#endif // BAR_SYSTRAY_PATCH
|
|
arrange(NULL);
|
|
focus(NULL);
|
|
}
|