From cfe1ea3959f64cd38f0e94fcccc5833c1f713a15 Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Sat, 24 Oct 2020 14:30:55 -0400 Subject: clean up --- Scripts/.config/Scripts/screen.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'Scripts') diff --git a/Scripts/.config/Scripts/screen.sh b/Scripts/.config/Scripts/screen.sh index 21d91fc..54b6807 100755 --- a/Scripts/.config/Scripts/screen.sh +++ b/Scripts/.config/Scripts/screen.sh @@ -3,35 +3,33 @@ #Feed this script either: # "l" for laptop screen only, # "h" for hdmi screen only, -# or "d" for dual vga/laptop. +# "v" for vga screen only, +# or "d" for dual hdmi/vga/laptop. -MONS="$(xrandr --query | grep -w 'connected' | cut -d ' ' -f1)" +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 + then param "$1" 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 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 --output VGA-1 --auto --right-of $PRIMARY; # home + 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" --output VGA-1 --auto --right-of "$PRIMARY"; # home fi ;} -laptop() { xrandr --output $PRIMARY --primary --auto --output HDMI-2 --off --output DP-1 --off --output VGA-1 --off ;} -#laptop() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --off ;} -hdmi() { xrandr --output HDMI-2 --auto --output $PRIMARY --off ;} +laptop() { xrandr --output "$PRIMARY" --primary --auto --output HDMI-2 --off --output DP-1 --off --output VGA-1 --off ;} +hdmi() { xrandr --output HDMI-2 --auto --output "$PRIMARY" --off ;} +vga() { xrandr --output VGA-1 --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." ;; + h) hdmi ;; + v) vga ;; + *) echo -e "Invalid parameter. Add one of the following:\n\"d\" for dualscreen laptop and VGA/HDMI.\n\"l\" for laptop only\n\"v\" for VGA only.\n\"h\" for HDMI only." ;; esac ;} d $1 -- cgit v1.2.3