X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=pm-utils%2F40autorandr;fp=pm-utils%2F40autorandr;h=74549fc49a7f4e64f7f932398b5c95e965ea7b18;hb=fb01d5e870d95c8dcd1006dcec0e825086332743;hp=2e8080afc59958d75cf31ab4ff32eedb143b7b82;hpb=37052d0f9d9e41e3fbf935f43477abd6098901b6;p=deb_pkgs%2Fautorandr.git diff --git a/pm-utils/40autorandr b/pm-utils/40autorandr index 2e8080a..74549fc 100755 --- a/pm-utils/40autorandr +++ b/pm-utils/40autorandr @@ -1,6 +1,7 @@ #!/bin/sh # # 40autorandr: Change autorandr profile on thaw/resume +exec > /var/log/autorandr.log 2>&1 # detect if we are being called as 40auto-disper or 40autorandr FORM=${0##*40} @@ -9,28 +10,25 @@ case $FORM in AUTORANDR="auto-disper -c --default default" ;; *) - AUTORANDR="autorandr -c" + AUTORANDR="autorandr -c --default default" ;; esac -echo "$AUTORANDR" detect_display() { for X in /tmp/.X11-unix/X*; do D="${X##/tmp/.X11-unix/X}" - user=$( who | grep \(:$D\) | cut -d ' ' -sf 1 | uniq ) - echo "Checking $X -- $D - $user" + user=$(w -h | awk -vD="$D" '$3 ~ ":"D"(\\.[0-9])?$" {print $1}' | head -1) if [ x"$user" != x"" ]; then - echo "AUTORANDR $D - $user" + logger "autorandr: Changing display configuration for user '$user'" export DISPLAY=":$D" /bin/su -c "${AUTORANDR}" "$user" fi done - echo "Done" } case "$1" in thaw|resume) - detect_display + detect_display ;; esac