diff options
| author | Kumar Damani <damani.kumar@gmail.com> | 2020-10-24 18:30:55 +0000 |
|---|---|---|
| committer | Kumar Damani <damani.kumar@gmail.com> | 2020-10-24 18:30:55 +0000 |
| commit | cfe1ea3959f64cd38f0e94fcccc5833c1f713a15 (patch) | |
| tree | b00c02cb41326649aef037f812d780813985d5b8 /Scripts | |
| parent | faa98d4907e1db196b392857e3f13e75ef238759 (diff) | |
clean up
Diffstat (limited to 'Scripts')
| -rwxr-xr-x | Scripts/.config/Scripts/screen.sh | 26 |
1 files changed, 12 insertions, 14 deletions
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 |
