diff options
-rwxr-xr-x | bin/impressive-display | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/bin/impressive-display b/bin/impressive-display index 799da03..9bd3641 100755 --- a/bin/impressive-display +++ b/bin/impressive-display @@ -173,10 +173,8 @@ else fi if [ -n "${RESOLUTION}" ]; then - if type -p xrandr xrandr 1>/dev/null; then - currentDisplay=`echo "$(xrandr)" | grep -w 'connected' | sed -r -e 's/connected.*//' | head -n 1` - xrandr -d :0 --output "$(echo $currentDisplay)" --mode $RESOLUTION - trap "cleanup" SIGINT SIGTERM ERR EXIT + if type -p xrandr 1>/dev/null; then + xrandr -d :0 --output "$(echo $currentOutput)" --mode $RESOLUTION fi fi @@ -198,9 +196,9 @@ sleep_hours_start=`echo $SLEEP_HOURS | grep -E '^[0-9]{2}-[0-9]{2}$' | sed -n - sleep_hours_end=`echo $SLEEP_HOURS | grep -E '^[0-9]{2}-[0-9]{2}$' | sed -n -r -e 's/^([0-9]{2})-([0-9]{2})$/\2/p'` function cleanup { - if type -p xrandr xrandr 1>/dev/null; then - $OUTPUT "Info: resetting resolution to $currentResolution" - xrandr -d :0 --output "$(echo $currentDisplay)" --auto + if type -p xrandr 1>/dev/null; then + $OUTPUT "Info: resetting resolution" + xrandr -d :0 --output "$(echo $currentOutput)" --auto fi if [ -r "$impressive_lock" ]; then |