diff options
Diffstat (limited to 'Scripts')
| -rwxr-xr-x | Scripts/.config/Scripts/screen.sh | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Scripts/.config/Scripts/screen.sh b/Scripts/.config/Scripts/screen.sh index 1bfcd53..d62992d 100755 --- a/Scripts/.config/Scripts/screen.sh +++ b/Scripts/.config/Scripts/screen.sh @@ -2,23 +2,35 @@ #Feed this script either: # "l" for laptop screen only, -# "v" for vga screen only, +# "h" for hdmi screen only, # or "d" for dual vga/laptop. -d() { if [[ $(xrandr -q | grep VGA-1\ con) ]] +MONS="$(xrandr --query | grep -w 'connected' | cut -d ' ' -f1)" +MON_COUNT=$(echo "$MONS" | wc -l) +PRIMARY=$(echo "$MONS" | head -n 1) + +d() { if [[ "$MON_COUNT" -gt 1 ]] then param $1 - else echo "No VGA input detected." + else echo "No secondary input detected." fi ;} + #dual() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --auto --left-of LVDS-1 ;} -dual() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --auto --right-of LVDS-1 ;} -laptop() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --off ;} -vga() { xrandr --output VGA-1 --auto --output LVDS-1 --off ;} +#dual() { xrandr --output eDP-1 --primary --auto --output HDMI-2 --auto --right-of eDP-1 ;} + +dual() { if [[ "$MON_COUNT" = 3 ]] + then xrandr --output $PRIMARY --primary --auto --output DP-1 --auto --left-of $PRIMARY --output HDMI-2 --auto --right-of $PRIMARY ; # office + else xrandr --output $PRIMARY --primary --auto --output HDMI-2 --auto --right-of $PRIMARY ; # home + fi ;} +laptop() { xrandr --output $PRIMARY --primary --auto --output HDMI-2 --off --output DP-1 --off ;} +#laptop() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --off ;} +hdmi() { xrandr --output HDMI-2 --auto --output $PRIMARY --off ;} #mirror() { xrandr --addmode VGA1 $lapres && xrandr --output LVDS1 --mode $lapres --output VGA1 --mode $lapres ;} param() { case $1 in d) dual ;; v) vga ;; + h) hdmi ;; l) laptop ;; *) echo -e "Invalid parameter. Add one of the following:\n\"d\" for dualscreen laptop and VGA.\n\"l\" for laptop only\n\"v\" for VGA only." ;; esac ;} |
