mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Dmenu script for monitor selection checks scripts.
This commit is contained in:
parent
1f68edef08
commit
080ad9427e
@ -54,6 +54,17 @@ multimon() { # Multi-monitor handler.
|
|||||||
*) morescreen ;;
|
*) morescreen ;;
|
||||||
esac ;}
|
esac ;}
|
||||||
|
|
||||||
|
loadconf() { # Load an existing configuration file saved from arandr
|
||||||
|
scripts=$(ls ~/.screenlayout/)
|
||||||
|
if [ -z "$scripts" ]; then
|
||||||
|
scripts="None"
|
||||||
|
fi
|
||||||
|
chosen=$(for s in $scripts; do echo $s; done | dmenu -i -p "Select configuration file:") &&
|
||||||
|
case "$chosen" in
|
||||||
|
*sh) ~/.screenlayout/$chosen ;;
|
||||||
|
*) exit ;;
|
||||||
|
esac ;}
|
||||||
|
|
||||||
# Get all possible displays
|
# Get all possible displays
|
||||||
allposs=$(xrandr -q | grep "connected")
|
allposs=$(xrandr -q | grep "connected")
|
||||||
|
|
||||||
@ -61,10 +72,11 @@ allposs=$(xrandr -q | grep "connected")
|
|||||||
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
|
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
|
||||||
|
|
||||||
# Get user choice including multi-monitor and manual selection:
|
# Get user choice including multi-monitor and manual selection:
|
||||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
chosen=$(printf "%s\\nmulti-monitor\\nexisting conf\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
"manual selection") arandr ; exit ;;
|
"manual selection") arandr ; exit ;;
|
||||||
"multi-monitor") multimon ;;
|
"multi-monitor") multimon ;;
|
||||||
|
"existing conf") loadconf ;;
|
||||||
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
|
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user