Descriptions in display script.

This commit is contained in:
Bartek Stalewski 2022-03-14 12:38:35 +01:00
parent 7863e76b07
commit b016a65fd6

View File

@ -1,7 +1,7 @@
#!/bin/sh
twoscreen() {
mirror=$(printf "no\\nyes" | dmenu -c -l 2 -i)
mirror=$(printf "no\\nyes" | dmenu -c -l 2 -i -p "mirror?")
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -c -l 2 -i)
internal=$(echo "$screens" | grep -v "$external")
@ -19,9 +19,9 @@ twoscreen() {
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -c -l 50 -i)
primary=$(echo "$screens" | dmenu -c -l 50 -i -p "select primary output")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -c -l 2 -i)
direction=$(printf "left\\nright" | dmenu -c -l 2 -i -p "secondary display location")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
@ -30,7 +30,7 @@ onescreen() {
if [ "$2" = "native" ]; then
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
else
scale=$(printf "native\\n0.75\\n0.5" | dmenu -c -l 3 -i) &&
scale=$(printf "native\\n0.75\\n0.5" | dmenu -c -l 3 -i -p "scale") &&
case "$scale" in
"native") xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
*) xrandr --output "$1" --auto --scale ${scale}x${scale} $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
@ -55,7 +55,7 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
{ onescreen "$screens" "native"; postrun; dunstify -u critical "💻 no device to switch"; exit ;}
# Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i) &&
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&
case "$chosen" in
"multi") twoscreen ;;
*) onescreen "$chosen" ;;