i3bar: Only configure tray on own outputs
Patch status: merged
Patch by Tony Crisci
Long description:
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`.
To apply this patch, use:
curl http://cr.i3wm.org/patch/281/raw.patch | git am
b/i3bar/src/xcb.c
19 |
@@ -1531,10 +1531,20 @@ void reconfig_windows(bool redraw_bars) { |
20 |
exit(EXIT_FAILURE); |
21 |
} |
22 |
|
23 |
- if (!tray_configured && |
24 |
- (!config.tray_output || |
25 |
- strcasecmp("none", config.tray_output) != 0)) { |
26 |
- init_tray(); |
27 |
+ const char *tray_output = (config.tray_output ? config.tray_output : SLIST_FIRST(outputs)->name); |
28 |
+ if (!tray_configured && strcasecmp(tray_output, "none") != 0) { |
29 |
+ /* Configuration sanity check: ensure this i3bar instance handles the output on |
30 |
+ * which the tray should appear (e.g. don’t initialize a tray if tray_output == |
31 |
+ * VGA-1 but output == [HDMI-1]). |
32 |
+ */ |
33 |
+ i3_output *output; |
34 |
+ SLIST_FOREACH(output, outputs, slist) { |
35 |
+ if (strcasecmp(output->name, tray_output) == 0 || |
36 |
+ (strcasecmp(tray_output, "primary") == 0 && output->primary)) { |
37 |
+ init_tray(); |
38 |
+ break; |
39 |
+ } |
40 |
+ } |
41 |
tray_configured = true; |
42 |
} |
43 |
} else { |