Consistency of dmenu scripts.
This commit is contained in:
parent
299f43a491
commit
a3aff0e7e8
3 changed files with 29 additions and 29 deletions
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
twoscreen() {
|
||||
mirror=$(printf "no\\nyes" | dmenu -l 20 -i -p "Mirror displays?")
|
||||
mirror=$(printf "no\\nyes" | dmenu -l 20 -i -p "mirror?")
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -l 20 -i -p "Optimize resolution for:")
|
||||
external=$(echo "$screens" | dmenu -l 20 -i -p "optimize resolution for")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
|
||||
tail -n 1 | awk '{print $1}')
|
||||
|
@ -19,9 +19,9 @@ twoscreen() {
|
|||
--output "$internal" --auto --same-as "$external" \
|
||||
--scale "$scale_x"x"$scale_y"
|
||||
else
|
||||
primary=$(echo "$screens" | dmenu -l 20 -i -p "Select primary display:")
|
||||
primary=$(echo "$screens" | dmenu -l 20 -i -p "primary")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -l 20 -i -p "What side of $primary should $secondary be on?")
|
||||
direction=$(printf "left\\nright" | dmenu -l 20 -i -p "what side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
fi
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
|||
|
||||
# If there's only one screen
|
||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||
{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected."; exit ;}
|
||||
{ onescreen "$screens"; postrun; notify-send "💻 Nothing to switch to."; exit ;}
|
||||
|
||||
# Get user choice including both and manual selection:
|
||||
chosen=$(printf -- "home-1\\nhome-2\\n----\\n%s\\n----\\nmulti" "$screens" | dmenu -l 20 -i -p "Select display:") &&
|
||||
chosen=$(printf -- "home-1\\nhome-2\\n----\\n%s\\n----\\nmulti" "$screens" | dmenu -l 20 -i -p "display") &&
|
||||
case "$chosen" in
|
||||
"home-1") home 0 ;;
|
||||
"home-2") home 1 ;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue