Need to explicitly lock the session on reboot (… long story …), so I tried making a service that contains the following line:
ExecStart=/bin/bash -c "dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:true"
(And yes, I could just do a Meta+L, but I want to do that programatically.) Unfortunately, the service fails:
Jun 15 18:15:25 DadsGram systemd[1]: Starting rmmod.service...
Jun 15 18:15:25 DadsGram bash[3539]: Failed to open connection to "session" message bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
Jun 15 18:15:25 DadsGram systemd[1]: rmmod.service: Main process exited, code=exited, status=1/FAILURE
Jun 15 18:15:25 DadsGram systemd[1]: rmmod.service: Failed with result 'exit-code'.
Jun 15 18:15:25 DadsGram systemd[1]: Failed to start rmmod.service.
Here’s what the service looks like in its entirety:
dad@DadsGram~ $ sudo systemctl cat rmmod.service
# /etc/systemd/system/rmmod.service
[Unit]
Description=Run rmmod & unmask gpe6E.
[Service]
Type=oneshot
# This stops the ACPI spamming of the syslog.
ExecStart=/bin/bash -c "rmmod int3403_thermal"
# This locks the screen, to work around the "monitors not detected" bug.
ExecStart=/bin/bash -c "dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:true"
[Install]
WantedBy=multi-user.target
Anybody got a better idea as to how I could lock the session on reboot?