1

I have two monitors; eDP1: primary (laptop's screen) and HDMI2, the external monitor. What I want to do is to use i3wm such that when I run a script (below), it put some workspaces on eDP1 and some on HDMI2. Using xrandr my HDMI2 is on the right side of eDP1:

xrandr --output HDMI2 --auto --right-of eDP1

Here is my script to achieve that:

#!/bin/sh

Out=HDMI2    

i3-msg "$workspace1"
i3-msg "move $workspace1 to output eDP1"
i3-msg "move $workspace2 to output eDP1"
i3-msg "move $workspace3 to output eDP1"
i3-msg "move $workspace4 to output eDP1"
i3-msg "move $workspace5 to output eDP1"
i3-msg "move $workspace6 to output eDP1"
i3-msg "move $workspace7 to output eDP1"
i3-msg "move $workspace8 to output eDP1"
i3-msg "move $workspace9 to output eDP1"
i3-msg "move $workspace10 to output $Out"
i3-msg "$workspace1"
# come back to workspace 1

But this doesn't work as expected. While I intend a fixed behavior, it put the screen randomly different by each run. At the moment these two commands works pretty fine in my config file and I easily move windows between monitors:

bindsym $mod+Ctrl+greater move workspace to output right
bindsym $mod+Ctrl+less move workspace to output left

p.s. I'm on Archlinux and i3 is 4.16.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.