From: Tony Crisci Date: Sun, 20 Oct 2013 11:51:50 +0000 (-0400) Subject: i3bar: Only configure tray on own outputs X-Git-Tag: 4.7~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cce3c8066a7fbccf48b93a5a794e81068cc35f9e;p=i3%2Fi3 i3bar: Only configure tray on own outputs If the config specifies a `tray_output` not in the list of outputs over which this bar will span, do not initialize a tray for the bar. Fixes former behavior, which was to initialize the tray without showing the icons, causing disapearing tray icons in multi-monitor environments when `tray_output` isnt `output`. --- diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index f407c9b1..45648633 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -1531,10 +1531,20 @@ void reconfig_windows(bool redraw_bars) { exit(EXIT_FAILURE); } - if (!tray_configured && - (!config.tray_output || - strcasecmp("none", config.tray_output) != 0)) { - init_tray(); + const char *tray_output = (config.tray_output ? config.tray_output : SLIST_FIRST(outputs)->name); + if (!tray_configured && strcasecmp(tray_output, "none") != 0) { + /* Configuration sanity check: ensure this i3bar instance handles the output on + * which the tray should appear (e.g. don’t initialize a tray if tray_output == + * VGA-1 but output == [HDMI-1]). + */ + i3_output *output; + SLIST_FOREACH(output, outputs, slist) { + if (strcasecmp(output->name, tray_output) == 0 || + (strcasecmp(tray_output, "primary") == 0 && output->primary)) { + init_tray(); + break; + } + } tray_configured = true; } } else {