Created
June 30, 2017 16:49
-
-
Save settinghead/5ee755a14d04d911a513dfbdd466a9a7 to your computer and use it in GitHub Desktop.
Xfce automatic dual monitor detection and and configuration
This file contains hidden or 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 | |
| let "target = 2" | |
| swon=false | |
| function nscreens { | |
| curr=$(xrandr | grep " connected" | wc -l) | |
| } | |
| function setup_scr { | |
| xrandr --output eDP-1 --mode 1920x1080 --pos 401x1080 \ | |
| --output HDMI-2 --auto --pos -0x0 | |
| } | |
| while true | |
| do | |
| sleep 4 | |
| nscreens | |
| if [ "$curr" -eq "$target" ] && [ "$swon" == false ] | |
| then | |
| setup_scr | |
| swon=true | |
| elif [ "$curr" -ne "$target" ] && [ "$swon" == true ] | |
| then | |
| xrandr | |
| swon=false | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment