Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- xrandr | grep -E '^(VGA|HDMI).* connected' | while read line; do
- port=`echo $line | sed -E 's/([^ ]+) .*/\1/'`
- isLeft=`echo $line | grep -E '\+0\+0'`
- if [[ $isLeft ]]; then
- if [[ $left ]]; then
- right=$left
- fi
- left=$port
- else
- right=$port
- fi
- if [[ $left && $right ]]; then
- xrandr --output $left --right-of $right
- fi
- done
- #You must connect two displays only (no less, no more).
- #They should have same resolution.
- #Tips: Set up hot keys.
Advertisement
Add Comment
Please, Sign In to add comment