mirror of
https://github.com/phillipberndt/autorandr
synced 2024-12-12 17:35:18 +00:00
abd5e778d3
Conflicts: pm-utils/40autorandr
35 lines
706 B
Bash
Executable File
35 lines
706 B
Bash
Executable File
#!/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}
|
|
case $FORM in
|
|
auto-disper)
|
|
AUTORANDR="auto-disper -c --default default"
|
|
;;
|
|
*)
|
|
AUTORANDR="autorandr -c --default default"
|
|
;;
|
|
esac
|
|
|
|
detect_display()
|
|
{
|
|
for X in /tmp/.X11-unix/X*; do
|
|
D="${X##/tmp/.X11-unix/X}"
|
|
user=`who | awk -vD="$D" '$2 ~ ":"D"(.[0-9])?$" {print $1}' | head -1`
|
|
if [ x"$user" != x"" ]; then
|
|
logger "autorandr: Changing display configuration for user '$user'"
|
|
export DISPLAY=":$D"
|
|
/bin/su -c "${AUTORANDR}" "$user"
|
|
fi
|
|
done
|
|
}
|
|
|
|
case "$1" in
|
|
thaw|resume)
|
|
detect_display
|
|
;;
|
|
esac
|