On 2017-04-02 10:04, Yamaban wrote:
On Sun, 2 Apr 2017 09:50, Carlos E. R. wrote:
How is your "xhost" setup? meaning: are you even allowed to conntact the $USER's Xscreen as root?
"xhost LOCAL:" as $USER allows other local users (including root) to connect to the $USERs Xscreen.
The correctly set DISPLAY env is still needed.
minas-tirith:~ # xhost LOCAL: xhost: unable to open display "" minas-tirith:~ # DISPLAY=:0.0 xhost LOCAL: non-network local connections being added to access control list minas-tirith:~ # DISPLAY=:0.0 xscreensaver-command -lock xscreensaver-command: activating and locking. minas-tirith:~ # And the screen saver kicks in. Thanks. So that's the trick! Thanks Let's try on the script. Well, the screen saver locks, as in crashes, with the change: case $1 in pre) echo "mine-sleep locking screen" DISPLAY=:0.0 xhost LOCAL: DISPLAY=:0.0 xscreensaver-command -lock Or restore from suspend, there is no dialog. A further DISPLAY=:0.0 xscreensaver-command -lock says there is no response from command. I have to kill the xscreensaver to restore. The log says: <3.6> 2017-04-02 22:08:28 minas-tirith systemd-sleep 7844 - - xscreensaver-command: already locked. <3.4> 2017-04-02 22:08:28 minas-tirith systemd-sleep 7848 - - /usr/lib/systemd/system-sleep/mine-sleep failed with error code 255. Ok, I know this one: on lid close, which triggers suspend, the screensaver is already activated by the desktop. I do not need to activate it myself a second time, but that should not make it crash. On hibernate from the command line, that's different. So I need to do: if [ "$2" = hibernate ]; then echo "mine-sleep locking screen" DISPLAY=:0.0 xhost LOCAL: DISPLAY=:0.0 xscreensaver-command -lock fi No, the sreensaver blocks. Let's try: if [ "$2" = suspend ]; then echo "INFO: Skip running $0 for $2" exit 0 else echo "INFO: running $0 for $2" DISPLAY=:0.0 xhost LOCAL: DISPLAY=:0.0 xscreensaver-command -lock fi This works for suspend. Later tonight I'll see if it works on hibernate. Progress! :-) -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))