mirror of https://github.com/jcmdln/gein
Browse Source
Added 'srandr.sh' which can utilize a local '~/.display.sh' to read values as shown in the following: DisplayConfigs="LVDS1 HDMI1 VGA1" LVDS1() { xrandr --output LVDS1 --auto } HDMI1() { xrandr --output HDMI1 --auto --above LVDS1 } VGA1() { xrandr --output VGA1 --auto --above LVDS1 }master
3 changed files with 51 additions and 14 deletions
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env sh |
||||
|
||||
Displays="" |
||||
|
||||
while :; do |
||||
if [[ $DISPLAY ]]; then |
||||
CDisplays=$(xrandr | grep ' connected' | awk '{print $1}') |
||||
DDisplays=$(xrandr | grep 'disconnected' | awk '{print $1}') |
||||
|
||||
if [ "$Displays" != "$CDisplays" ]; then |
||||
for display in $CDisplays; do |
||||
if [ -e "$HOME/.display.sh" ]; then |
||||
. "$HOME/.display.sh" |
||||
for config in $DisplayConfigs; do |
||||
if [ "$display" == "$config" ]; then |
||||
$config |
||||
fi |
||||
done |
||||
else |
||||
xrandr --output "$display" --auto |
||||
fi |
||||
done |
||||
|
||||
for display in $DDisplays; do |
||||
xrandr --output "$display" --off |
||||
done |
||||
|
||||
Displays="$Connected" |
||||
fi |
||||
else |
||||
sleep 5 |
||||
fi |
||||
done |
Loading…
Reference in new issue