all in case statement

This commit is contained in:
Luke Smith 2018-09-24 11:20:17 -04:00
parent 4b93d5eeae
commit be0b2f3aef

View file

@ -5,7 +5,6 @@
# User may also select "manual selection" which opens arandr. # User may also select "manual selection" which opens arandr.
# I plan on adding a routine from multi-monitor setups later. # I plan on adding a routine from multi-monitor setups later.
twoscreen() { # If multi-monitor is selected and there are two screens. twoscreen() { # If multi-monitor is selected and there are two screens.
primary=$(echo "$screens" | dmenu -i -p "asdf") primary=$(echo "$screens" | dmenu -i -p "asdf")
secondary=$(echo "$screens" | grep -v "$primary") secondary=$(echo "$screens" | grep -v "$primary")
@ -23,6 +22,7 @@ morescreen() { # If multi-monitor is selected and there are more than two screen
multimon() { # Multi-monitor handler. multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in case "$(echo "$screens" | wc -l)" in
1) xrandr $(echo "$allposs" | awk '{print "--output", $1, "--auto"}' | tr '\n' ' ') ;;
2) twoscreen ;; 2) twoscreen ;;
*) morescreen ;; *) morescreen ;;
esac ;} esac ;}
@ -33,9 +33,6 @@ allposs=$(xrandr -q | grep "connected")
# Get all connected screens. # Get all connected screens.
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}') screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
# If only one screen, activate it and exit.
[ "$(echo "$screens" | wc -l)" -lt 2 ] && xrandr $(echo "$allposs" | awk '{print "--output", $1, "--auto"}' | tr '\n' ' ') ||
# Get user choice including multi-monitor and manual selection: # Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in case "$chosen" in