mirror of
https://github.com/phillipberndt/autorandr
synced 2025-02-20 05:47:00 +00:00
40autorandr had issues when resuming on a system where one or more users have multiple terminal sessions open. enhanced 40autorandr to allow being called as 40auto-disper to automatically swap to using auto-disper semantics
37 lines
647 B
Bash
Executable File
37 lines
647 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# 40autorandr: Change autorandr profile on thaw/resume
|
|
|
|
# detect if we are being called as 40auto-disper or 40autorandr
|
|
FORM=${0##*40}
|
|
case $FORM in
|
|
auto-disper)
|
|
AUTORANDR="auto-disper -c"
|
|
;;
|
|
*)
|
|
AUTORANDR="autorandr -c"
|
|
;;
|
|
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"
|
|
if [ x"$user" != x"" ]; then
|
|
echo "AUTORANDR $D - $user"
|
|
export DISPLAY=":$D"
|
|
/bin/su -c "${AUTORANDR}" "$user"
|
|
fi
|
|
done
|
|
echo "Done"
|
|
}
|
|
|
|
case "$1" in
|
|
thaw|resume)
|
|
detect_display
|
|
;;
|
|
esac
|