diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 2c82225..aa467aa 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -39,11 +39,23 @@ twoscreen() { # If multi-monitor is selected and there are two screens. secondary=$(echo "$screens" | grep -v -w "$primary") direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") rotation=$(printf "normal\\nleft\\nright" | dmenu -i -p "Rotate $secondary?") - xrandr --output "$primary" --auto --scale 1.0x1.0 \ - --output "$secondary" --"$direction"-of "$primary" --auto + setup fi } +default() { + primary=$(echo "$allposs" | grep -w "connected primary" | awk '{printf $1}') + secondary=$(echo "$screens" | grep -v -w "$primary") + direction="left" + rotation="normal" + setup +} + +setup() { + xrandr --output "$primary" --auto --scale 1.0x1.0 \ + --output "$secondary" --"$direction"-of "$primary" --auto +} + morescreen() { # If multi-monitor is selected and there are more than two screens. primary=$(echo "$screens" | dmenu -i -p "Select primary display:") secondary=$(echo "$screens" | grep -v -w "$primary" | dmenu -i -p "Select secondary display:") @@ -66,8 +78,9 @@ allposs=$(xrandr -q | grep -w "connected") screens=$(echo "$allposs" | awk '{print $1}') # Get user choice including multi-monitor and manual selection: -chosen=$(printf "multi-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && +chosen=$(printf "default\\n\\nmulti-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && case "$chosen" in + "default") default ;; "manual selection") arandr ; exit ;; "multi-monitor") multimon ;; *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;