]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: accept 'primary' for output config option 2705/head
authorlebenlechzer <lebenlechzer@gmail.com>
Sun, 12 Mar 2017 20:17:12 +0000 (21:17 +0100)
committerlebenlechzer <lebenlechzer@gmail.com>
Sun, 12 Mar 2017 20:17:12 +0000 (21:17 +0100)
docs/userguide
i3bar/src/ipc.c
i3bar/src/outputs.c

index 40e9e3b9ea24f63328643fe317bc23641a291b61..4946a1bae938438f81019358c489bcdce8d6e5f2 100644 (file)
@@ -1378,7 +1378,7 @@ directive multiple times.
 
 *Syntax*:
 ---------------
-output <output>
+output primary|<output>
 ---------------
 
 *Example*:
@@ -1400,7 +1400,19 @@ bar {
         statusline #ffffff
     }
 }
+
+# show bar on the primary monitor and on HDMI2
+bar {
+    output primary
+    output HDMI2
+    status_command i3status
+}
+
 -------------------------------
+Note that you might not have a primary output configured yet. To do so, run:
+-------------------------
+xrandr --output <output> --primary
+-------------------------
 
 === Tray output
 
index cc5074e5b27306e01bdff16d2f6e2f116753b3de..459684ef32dc70afd3f065ae01a41d0b12f12a92 100644 (file)
@@ -63,12 +63,18 @@ void got_subscribe_reply(char *reply) {
  *
  */
 void got_output_reply(char *reply) {
+    DLOG("Clearing old output configuration...\n");
+    i3_output *o_walk;
+    SLIST_FOREACH(o_walk, outputs, slist) {
+        destroy_window(o_walk);
+    }
+    FREE_SLIST(outputs, i3_output);
+
     DLOG("Parsing outputs JSON...\n");
     parse_outputs_json(reply);
     DLOG("Reconfiguring windows...\n");
     reconfig_windows(false);
 
-    i3_output *o_walk;
     SLIST_FOREACH(o_walk, outputs, slist) {
         kick_tray_clients(o_walk);
     }
index 480c00be7dd90a1b9e500b3074e87888da64bcbc..e7cd6eebb0ee402327df2f0d9971d8fb5c9a247b 100644 (file)
@@ -189,11 +189,12 @@ static int outputs_end_map_cb(void *params_) {
     if (config.num_outputs > 0) {
         bool handle_output = false;
         for (int c = 0; c < config.num_outputs; c++) {
-            if (strcasecmp(params->outputs_walk->name, config.outputs[c]) != 0)
-                continue;
-
-            handle_output = true;
-            break;
+            if (strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0 ||
+                    (strcasecmp(config.outputs[c], "primary") == 0 &&
+                     params->outputs_walk->primary)) {
+                handle_output = true;
+                break;
+            }
         }
         if (!handle_output) {
             DLOG("Ignoring output \"%s\", not configured to handle it.\n",