On Fri, 2023-03-31 at 20:15 -0400, Ken Dibble wrote: > Having a few moments, I was going through a test Chimaera system
> looking
> for artifacts of uninstalled packages, files that should have been
> deleted, etc.
> As part of that process I happened on a process that I did not know
> about running.
> xscreensaver-systemd
> From the man page:
> The xscreensaver-systemd program is a helper daemon launched by
> xscreensaver(1) for systemd(1) or elogind(8) integration. It does two
> things:
> *
> When the system is about to go to sleep (e.g., the laptop lid has
> just been closed) it locks the screen just before the system sleeps,
> by running xscreensaver-command --suspend. When the system wakes up
> again, it runs xscreensaver-command --deactivate to make the unlock
> dialog appear immediately. It does this through the
> org.freedesktop.login1(5) D-Bus interface.
> *
> When another process asks for the screen saver to be inhibited (e.g.
> because a video is playing) this program periodically runs
> xscreensaver-command --deactivate to keep the display un-blanked. It
> does this until that other program asks for it to stop, or exits. It
> does this through the org.freedesktop.ScreenSaver(5),
> org.gnome.SessionManager(5) and
> org.kde.Solid.PowerManagement.PolicyAgent(5) D-Bus interfaces.
>
> According to elogind's github page:
> elogind is the systemd project's "logind", extracted to be a
> standalone daemon
> My understanding of the documentation is that communication with
> elogind should be through the
> D-Bus interface.
> My questions, which I am sure that I will not be able to understand
> the answer to, are
> Why do we have something that looks like it belongs to systemd
> running?
> Why do we need to have a separate daemon just to put something on the
> DBus interface? You don't need to use xscreensaver-systemd to achieve a screenlock on
resume from sleep.
You can still do it using pmtools to suspend/resume by including an
appropriate script in /etc/pm/sleep.d/
I have this script: 999password-protect-waking
#!/bin/sh
# This script requires a user login when returning from
# a suspended or hibernated state
. "${PM_FUNCTIONS}"
case "$1" in
resume|thaw)
sudo -u $SUDO_USER /usr/bin/cinnamon-screensaver-command -a
;;
suspend|hibernate)
sudo -u $SUDO_USER /usr/bin/cinnamon-screensaver-command -d
;;
esac