Center patch for dmenu.
This commit is contained in:
parent
e05070759f
commit
32c401e9ae
12 changed files with 958 additions and 20 deletions
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
twoscreen() {
|
||||
mirror=$(printf "no\\nyes" | dmenu -l 2 -i -p "mirror")
|
||||
mirror=$(printf "no\\nyes" | dmenu -c -l 2 -i)
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -l 2 -i -p "optimize resolution for")
|
||||
external=$(echo "$screens" | dmenu -c -l 2 -i)
|
||||
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 50 -i -p "primary")
|
||||
primary=$(echo "$screens" | dmenu -c -l 50 -i)
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -l 2 -i -p "side of $primary should $secondary be on")
|
||||
direction=$(printf "left\\nright" | dmenu -c -l 2 -i)
|
||||
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 -l 3 -i -p "scale") &&
|
||||
scale=$(printf "native\\n0.75\\n0.5" | dmenu -c -l 3 -i) &&
|
||||
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 -l 5 -i -p "display") &&
|
||||
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i) &&
|
||||
case "$chosen" in
|
||||
"multi") twoscreen ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue