[scripts] fix: displayselect
fix default config + refactor code
This commit is contained in:
parent
5b158166db
commit
cacfe657a7
@ -39,9 +39,21 @@ 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?")
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
||||
@ -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' ' ') ;;
|
||||
|
Reference in New Issue
Block a user