Assign workspaces on i3 to multiple displays











up vote
8
down vote

favorite
4












I've switched on using i3 on my Linux laptop. I'm usually using only the laptop's internal monitor (display eDP1), but when I'm at work I tend to connect a secondary monitor to my computer's HDMI port (display HDMI2). So far, I've made this work fine by adding these commands to my i3 config file:



# use workspaces on different monitors
workspace "1: P1" output eDP1
workspace "2: P2" output eDP1
workspace "3: P3" output eDP1
workspace "4: P4" output eDP1
workspace "5: P5" output eDP1
workspace "6: S1" output HDMI2
workspace "7: S2" output HDMI2
workspace "8: S3" output HDMI2
workspace "9: S4" output HDMI2
workspace "10: S5" output HDMI2

# add HDMI monitor when connected
exec --no-startup-id xrandr --output HDMI2 --right-of eDP1
bindsym $mod+m exec --no-startup-id xrandr --output HDMI2 --auto --right-of eDP1


In other words, when I connect my HDMI display I just press Mod+M to get i3 to detect it, place it right of my primary display, and delegate 5 named workspaces (6-10) to it.



Here's the problem: At home, I have another monitor that I can connect with VGA (display DP2). I can run the xrandr command above to place this display to the right of my primary display as well, but I can't get the workspaces to be assigned to this display by default, unless I replace the rules I already have for my HDMI monitor. I would like both these workspaces to work the same no matter which monitor I use, so this is not an option.



TL;DR Is there a way to assign workspaces to two different displays, depending on which display is connected (assuming they never will be connected at the same time)?










share|improve this question


























    up vote
    8
    down vote

    favorite
    4












    I've switched on using i3 on my Linux laptop. I'm usually using only the laptop's internal monitor (display eDP1), but when I'm at work I tend to connect a secondary monitor to my computer's HDMI port (display HDMI2). So far, I've made this work fine by adding these commands to my i3 config file:



    # use workspaces on different monitors
    workspace "1: P1" output eDP1
    workspace "2: P2" output eDP1
    workspace "3: P3" output eDP1
    workspace "4: P4" output eDP1
    workspace "5: P5" output eDP1
    workspace "6: S1" output HDMI2
    workspace "7: S2" output HDMI2
    workspace "8: S3" output HDMI2
    workspace "9: S4" output HDMI2
    workspace "10: S5" output HDMI2

    # add HDMI monitor when connected
    exec --no-startup-id xrandr --output HDMI2 --right-of eDP1
    bindsym $mod+m exec --no-startup-id xrandr --output HDMI2 --auto --right-of eDP1


    In other words, when I connect my HDMI display I just press Mod+M to get i3 to detect it, place it right of my primary display, and delegate 5 named workspaces (6-10) to it.



    Here's the problem: At home, I have another monitor that I can connect with VGA (display DP2). I can run the xrandr command above to place this display to the right of my primary display as well, but I can't get the workspaces to be assigned to this display by default, unless I replace the rules I already have for my HDMI monitor. I would like both these workspaces to work the same no matter which monitor I use, so this is not an option.



    TL;DR Is there a way to assign workspaces to two different displays, depending on which display is connected (assuming they never will be connected at the same time)?










    share|improve this question
























      up vote
      8
      down vote

      favorite
      4









      up vote
      8
      down vote

      favorite
      4






      4





      I've switched on using i3 on my Linux laptop. I'm usually using only the laptop's internal monitor (display eDP1), but when I'm at work I tend to connect a secondary monitor to my computer's HDMI port (display HDMI2). So far, I've made this work fine by adding these commands to my i3 config file:



      # use workspaces on different monitors
      workspace "1: P1" output eDP1
      workspace "2: P2" output eDP1
      workspace "3: P3" output eDP1
      workspace "4: P4" output eDP1
      workspace "5: P5" output eDP1
      workspace "6: S1" output HDMI2
      workspace "7: S2" output HDMI2
      workspace "8: S3" output HDMI2
      workspace "9: S4" output HDMI2
      workspace "10: S5" output HDMI2

      # add HDMI monitor when connected
      exec --no-startup-id xrandr --output HDMI2 --right-of eDP1
      bindsym $mod+m exec --no-startup-id xrandr --output HDMI2 --auto --right-of eDP1


      In other words, when I connect my HDMI display I just press Mod+M to get i3 to detect it, place it right of my primary display, and delegate 5 named workspaces (6-10) to it.



      Here's the problem: At home, I have another monitor that I can connect with VGA (display DP2). I can run the xrandr command above to place this display to the right of my primary display as well, but I can't get the workspaces to be assigned to this display by default, unless I replace the rules I already have for my HDMI monitor. I would like both these workspaces to work the same no matter which monitor I use, so this is not an option.



      TL;DR Is there a way to assign workspaces to two different displays, depending on which display is connected (assuming they never will be connected at the same time)?










      share|improve this question













      I've switched on using i3 on my Linux laptop. I'm usually using only the laptop's internal monitor (display eDP1), but when I'm at work I tend to connect a secondary monitor to my computer's HDMI port (display HDMI2). So far, I've made this work fine by adding these commands to my i3 config file:



      # use workspaces on different monitors
      workspace "1: P1" output eDP1
      workspace "2: P2" output eDP1
      workspace "3: P3" output eDP1
      workspace "4: P4" output eDP1
      workspace "5: P5" output eDP1
      workspace "6: S1" output HDMI2
      workspace "7: S2" output HDMI2
      workspace "8: S3" output HDMI2
      workspace "9: S4" output HDMI2
      workspace "10: S5" output HDMI2

      # add HDMI monitor when connected
      exec --no-startup-id xrandr --output HDMI2 --right-of eDP1
      bindsym $mod+m exec --no-startup-id xrandr --output HDMI2 --auto --right-of eDP1


      In other words, when I connect my HDMI display I just press Mod+M to get i3 to detect it, place it right of my primary display, and delegate 5 named workspaces (6-10) to it.



      Here's the problem: At home, I have another monitor that I can connect with VGA (display DP2). I can run the xrandr command above to place this display to the right of my primary display as well, but I can't get the workspaces to be assigned to this display by default, unless I replace the rules I already have for my HDMI monitor. I would like both these workspaces to work the same no matter which monitor I use, so this is not an option.



      TL;DR Is there a way to assign workspaces to two different displays, depending on which display is connected (assuming they never will be connected at the same time)?







      i3 workspaces






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 12 '17 at 2:36









      Frxstrem

      91116




      91116






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          9
          down vote



          +50










          You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555



          So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:



          xrandr --output DP2 --auto --right-of eDP1
          i3-msg "workspace 6, move workspace to output DP2"
          ...
          i3-msg "workspace 10, move workspace to output DP2"


          With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.






          share|improve this answer




























            up vote
            0
            down vote













            According to the user's guide syntax:



            workspace 1 output eDP1
            ...
            workspace 6 output HDMI2 VGA


            should work.



            Or you may define primary and secondary outputs on your machines if not set (xrandr --output <output> --primary) and use this syntax:



            workspace 1 output primary
            ...
            workspace 6 output secondary





            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f344329%2fassign-workspaces-on-i3-to-multiple-displays%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              9
              down vote



              +50










              You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555



              So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:



              xrandr --output DP2 --auto --right-of eDP1
              i3-msg "workspace 6, move workspace to output DP2"
              ...
              i3-msg "workspace 10, move workspace to output DP2"


              With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.






              share|improve this answer

























                up vote
                9
                down vote



                +50










                You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555



                So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:



                xrandr --output DP2 --auto --right-of eDP1
                i3-msg "workspace 6, move workspace to output DP2"
                ...
                i3-msg "workspace 10, move workspace to output DP2"


                With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.






                share|improve this answer























                  up vote
                  9
                  down vote



                  +50







                  up vote
                  9
                  down vote



                  +50




                  +50




                  You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555



                  So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:



                  xrandr --output DP2 --auto --right-of eDP1
                  i3-msg "workspace 6, move workspace to output DP2"
                  ...
                  i3-msg "workspace 10, move workspace to output DP2"


                  With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.






                  share|improve this answer












                  You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555



                  So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:



                  xrandr --output DP2 --auto --right-of eDP1
                  i3-msg "workspace 6, move workspace to output DP2"
                  ...
                  i3-msg "workspace 10, move workspace to output DP2"


                  With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 14 '17 at 19:19









                  anlar

                  8571618




                  8571618
























                      up vote
                      0
                      down vote













                      According to the user's guide syntax:



                      workspace 1 output eDP1
                      ...
                      workspace 6 output HDMI2 VGA


                      should work.



                      Or you may define primary and secondary outputs on your machines if not set (xrandr --output <output> --primary) and use this syntax:



                      workspace 1 output primary
                      ...
                      workspace 6 output secondary





                      share|improve this answer

























                        up vote
                        0
                        down vote













                        According to the user's guide syntax:



                        workspace 1 output eDP1
                        ...
                        workspace 6 output HDMI2 VGA


                        should work.



                        Or you may define primary and secondary outputs on your machines if not set (xrandr --output <output> --primary) and use this syntax:



                        workspace 1 output primary
                        ...
                        workspace 6 output secondary





                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          According to the user's guide syntax:



                          workspace 1 output eDP1
                          ...
                          workspace 6 output HDMI2 VGA


                          should work.



                          Or you may define primary and secondary outputs on your machines if not set (xrandr --output <output> --primary) and use this syntax:



                          workspace 1 output primary
                          ...
                          workspace 6 output secondary





                          share|improve this answer












                          According to the user's guide syntax:



                          workspace 1 output eDP1
                          ...
                          workspace 6 output HDMI2 VGA


                          should work.



                          Or you may define primary and secondary outputs on your machines if not set (xrandr --output <output> --primary) and use this syntax:



                          workspace 1 output primary
                          ...
                          workspace 6 output secondary






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 23 at 22:31









                          caseneuve

                          13




                          13






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f344329%2fassign-workspaces-on-i3-to-multiple-displays%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Morgemoulin

                              Scott Moir

                              Souastre