]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #2771 from hwangcc23/fix-2764
authorIngo Bürk <admin@airblader.de>
Tue, 16 May 2017 16:39:37 +0000 (18:39 +0200)
committerGitHub <noreply@github.com>
Tue, 16 May 2017 16:39:37 +0000 (18:39 +0200)
Support to get the primary output

docs/userguide
src/randr.c

index 4eb8c7f59c36b39370de49f6aa8b963bde030d81..0d5de3b9056c86eff0e483124825d27192588e6e 100644 (file)
@@ -1922,7 +1922,7 @@ output::
 ----------------------------------------------
 focus left|right|down|up
 focus parent|child|floating|tiling|mode_toggle
-focus output left|right|up|down|<output>
+focus output left|right|up|down|primary|<output>
 ----------------------------------------------
 
 *Examples*:
@@ -1944,8 +1944,17 @@ bindsym $mod+x focus output right
 
 # Focus the big output
 bindsym $mod+x focus output HDMI-2
+
+# Focus the primary output
+bindsym $mod+x focus output primary
 -------------------------------------------------
 
+-------------------------------
+Note that you might not have a primary output configured yet. To do so, run:
+-------------------------
+xrandr --output <output> --primary
+-------------------------
+
 === Moving containers
 
 Use the +move+ command to move a container.
@@ -2195,8 +2204,8 @@ To move a container to another RandR output (addressed by names like +LVDS1+ or
 
 *Syntax*:
 ------------------------------------------------------------
-move container to output left|right|down|up|current|<output>
-move workspace to output left|right|down|up|current|<output>
+move container to output left|right|down|up|current|primary|<output>
+move workspace to output left|right|down|up|current|primary|<output>
 ------------------------------------------------------------
 
 *Examples*:
@@ -2207,8 +2216,17 @@ bindsym $mod+x move workspace to output right
 
 # Put this window on the presentation output.
 bindsym $mod+x move container to output VGA1
+
+# Put this window on the primary output.
+bindsym $mod+x move container to output primary
 --------------------------------------------------------
 
+-------------------------------
+Note that you might not have a primary output configured yet. To do so, run:
+-------------------------
+xrandr --output <output> --primary
+-------------------------
+
 === Moving containers/windows to marks
 
 To move a container to another container with a specific mark (see <<vim_like_marks>>),
index 16ef62b8f767b6a027da5426964f4315e19a4cf7..8496fd0338a935b5b32e06ba54773a18ce343f2a 100644 (file)
@@ -45,10 +45,13 @@ static Output *get_output_by_id(xcb_randr_output_t id) {
  */
 Output *get_output_by_name(const char *name) {
     Output *output;
-    TAILQ_FOREACH(output, &outputs, outputs)
-    if (output->active &&
-        strcasecmp(output->name, name) == 0)
-        return output;
+    bool get_primary = (strcasecmp("primary", name) == 0);
+    TAILQ_FOREACH(output, &outputs, outputs) {
+        if ((output->primary && get_primary) ||
+            (output->active && strcasecmp(output->name, name) == 0)) {
+            return output;
+        }
+    }
 
     return NULL;
 }