Merge branch 'dev' into thesis

displayselect: add external mode for docked setup
This commit is contained in:
David JULIEN 2022-11-25 16:45:31 +01:00
commit d0b59a6c93
No known key found for this signature in database
GPG Key ID: 1DD6B2BA6DD78810
1 changed files with 15 additions and 3 deletions

View File

@ -44,7 +44,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
}
default() {
primary=$(echo "$allposs" | grep -w "connected primary" | awk '{printf $1}')
primary=$(echo "$allposs" | grep -w "connected primary" | awk '{ print $1 }')
secondary=$(echo "$screens" | grep -v -w "$primary")
direction="left"
rotation="normal"
@ -52,10 +52,21 @@ default() {
setup
}
external() {
internal=$(echo "$screens" | dmenu -i -p "Select internal display:")
screens=$(echo "$screens" | grep -v -w "eDP-1")
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
xrandr --output $primary --primary
default
}
setup() {
[ -z "$mode" ] && mode="auto"
xrandr --output "$primary" --auto --scale 1.0x1.0 \
xrandr --output "$primary" --primary --auto --scale 1.0x1.0 \
--output "$secondary" --"$direction"-of "$primary" --$mode
[ -n "$internal" ] && xrandr --output "$internal" --off
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
@ -80,9 +91,10 @@ allposs=$(xrandr -q | grep -w "connected")
screens=$(echo "$allposs" | awk '{print $1}')
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "default\\nmulti-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
chosen=$(printf "default\\nexternal\\nmulti-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"default") default ;;
"external") external ;;
"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' ' ') ;;