diff --git a/gui-daemon/guid.conf b/gui-daemon/guid.conf index 7f2dff0..3f1530a 100644 --- a/gui-daemon/guid.conf +++ b/gui-daemon/guid.conf @@ -70,6 +70,13 @@ global: { # # trayicon_mode = "border1"; + # Set the fill color to be shown in a window when content is pending or + # unavailable. This is rarely visible except very briefly. Possible values are + # a color name (see: /etc/X11/rgb.txt) or a specification in format 0xRRGGBB. + # When running a dark-styled desktop theme, "black" is recommended. + # + # window_background_color = "white"; + # Timeout when waiting for qubes-gui-agent # # startup_timeout = 45; diff --git a/gui-daemon/xside.c b/gui-daemon/xside.c index 0a4d8bb..947596c 100644 --- a/gui-daemon/xside.c +++ b/gui-daemon/xside.c @@ -361,7 +361,7 @@ static Window mkwindow(Ghandles * g, struct windowdata *vm_window) my_size_hints.height = vm_window->height; attr.override_redirect = vm_window->override_redirect; - attr.background_pixel = WhitePixel(g->display, DefaultScreen(g->display)); + attr.background_pixel = g->window_background_pixel; child_win = XCreateWindow(g->display, g->root_win, vm_window->x, vm_window->y, vm_window->width, @@ -690,6 +690,9 @@ static void mkghandles(Ghandles * g) else if (g->trayicon_mode == TRAY_TINT) init_tray_tint(g); /* nothing extra needed for TRAY_BORDER */ + /* parse window background color */ + g->window_background_pixel = parse_color(g->window_background_color_pre_parse, + g->display, g->screen).pixel; /* parse -p arguments now, as we have X server connection */ parse_cmdline_prop(g); /* init window lists */ @@ -3791,7 +3794,7 @@ static void usage(FILE *stream) fprintf(stream, " --domid=ID, -d ID\tdomain ID running GUI agent\n"); fprintf(stream, " --target-domid=ID, -t ID\tdomain ID of actual VM (may be different from --domid in case of stubdomain)\n"); fprintf(stream, " --name=NAME, -N NAME\tVM name\n"); - fprintf(stream, " --color=COLOR, -c COLOR\tVM color (in format 0xRRGGBB)\n"); + fprintf(stream, " --color=COLOR, -c COLOR\tVM color (format 0xRRGGBB or color name)\n"); fprintf(stream, " --label=LABEL_INDEX, -l LABEL_INDEX\tVM label index\n"); fprintf(stream, " --icon=ICON, -i ICON\tIcon name (without suffix), or full icon path\n"); fprintf(stream, " --qrexec-for-clipboard, -Q\tforce usage of Qrexec for clipboard operations\n"); @@ -4123,6 +4126,7 @@ static void load_default_config_values(Ghandles * g) g->trayicon_border = 0; g->trayicon_tint_reduce_saturation = 0; g->trayicon_tint_whitehack = 0; + g->window_background_color_pre_parse = "white"; } // parse string describing key sequence like Ctrl-Alt-c @@ -4211,6 +4215,11 @@ static void parse_vm_config(Ghandles * g, config_setting_t * group) parse_trayicon_mode(g, config_setting_get_string(setting)); } + if ((setting = + config_setting_get_member(group, "window_background_color"))) { + g->window_background_color_pre_parse = config_setting_get_string(setting); + } + if ((setting = config_setting_get_member(group, "startup_timeout"))) { g->startup_timeout = config_setting_get_int(setting); diff --git a/gui-daemon/xside.h b/gui-daemon/xside.h index 8ca478e..f799c86 100644 --- a/gui-daemon/xside.h +++ b/gui-daemon/xside.h @@ -225,6 +225,8 @@ struct _global_handles { int trayicon_border; /* position of trayicon border - 0 - no border, 1 - at the edges, 2 - 1px from the edges */ bool trayicon_tint_reduce_saturation; /* reduce trayicon saturation by 50% (available only for "tint" mode) */ bool trayicon_tint_whitehack; /* replace white pixels with almost-white 0xfefefe (available only for "tint" mode) */ + const char *window_background_color_pre_parse; /* user-provided description of window background pixel */ + unsigned long window_background_pixel; /* parsed version of the above */ bool disable_override_redirect; /* Disable “override redirect” windows */ char *screensaver_names[MAX_SCREENSAVER_NAMES]; /* WM_CLASS names for windows detected as screensavers */ Cursor *cursors; /* preloaded cursors (using XCreateFontCursor) */