Last active
October 16, 2017 14:06
-
-
Save mantono/fc1eb2f52a26e2e87975ee45de97a612 to your computer and use it in GitHub Desktop.
Move all i3 workspaces to connected monitor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONITORS=$(xrandr|grep -c " connected") | |
if [[ "$MONITORS" == 1 ]] | |
then | |
xrandr --output eDP-1 --primary | |
for i in {1..10} | |
do | |
i3-msg workspace $i | |
i3-msg move workspace to output $(xrandr|grep connected|grep -v disconnected|cut -d " " -f 1) | |
done | |
elif [[ "$MONITORS" == 2 ]] | |
then | |
xrandr --output DP-1 --primary | |
for i in {1..9} | |
do | |
i3-msg workspace $i | |
i3-msg move workspace to output $(xrandr|grep connected|grep -v disconnected|cut -d " " -f 1|tail -n 1) | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment