02.04.2017 23:40, Carlos E. R. пишет:
case $1 in pre) echo "mine-sleep locking screen" DISPLAY=:0.0 xhost LOCAL: DISPLAY=:0.0 xscreensaver-command -lock
You misunderstand. "xhost local:" should be executed once in your desktop session by *you*, to grant access to your X server to *other* users. Using it as above won't work (unless access is already granted by other means). By default X server is using primitive access control based on "magic cookie", which is stored in your home directory. When you run command using "su -", magic cookie is propagated from current (calling) user to called user session by PAM module. When you run it in other user's login context (or from daemon context), your magic cooker is not known. So either both commands are rejected or both commands work (but then "xhost" is redundant).