i3 - improved tiling WM


i3bar: Only configure tray on own outputs

Patch status: needinfo

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.

Fix former behavior, which was to initialize the tray without showing
the icons.

To apply this patch, use:
curl http://cr.i3wm.org/patch/277/raw.patch | git am

b/i3bar/src/xcb.c

18
@@ -1531,11 +1531,19 @@ void reconfig_windows(bool redraw_bars) {
19
                 exit(EXIT_FAILURE);
20
             }
21
 
22
-            if (!tray_configured &&
23
-                (!config.tray_output ||
24
-                 strcasecmp("none", config.tray_output) != 0)) {
25
-                init_tray();
26
-                tray_configured = true;
27
+            char *tray_output = (config.tray_output ? config.tray_output : SLIST_FIRST(outputs)->name);
28
+            if (!tray_configured && strcasecmp(tray_output, "none") != 0) {
29
+                /* make sure the bar is actually on this output or the tray
30
+                 * icons might not show up */
31
+                i3_output *output;
32
+                SLIST_FOREACH(output, outputs, slist) {
33
+                    if (strcasecmp(output->name, tray_output) == 0 ||
34
+                            strcasecmp(tray_output, "primary") == 0 && output->primary) {
35
+                        init_tray();
36
+                        tray_configured = true;
37
+                        break;
38
+                    }
39
+                }
40
             }
41
         } else {
42
             /* We already have a bar, so we just reconfigure it */