Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancements and bugfix for pm-utils script #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pm-utils/40auto-disper
19 changes: 16 additions & 3 deletions pm-utils/40autorandr
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,35 @@
#
# 40autorandr: Change autorandr profile on thaw/resume

AUTORANDR="autorandr -c"
# 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 | awk -vD="$D" '$5 ~ "\\(:"D"\\)$" {print $1}')
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
detect_display
;;
esac