This problem was bugging for a very long time, I had tried many solutions, but I only got a clearer picture of what was necessary after reading what everyone wrote here. This question with all the answers were invaluable for me to reach this solution.
Xfce power manager systemd how to#
I created ~/.config/autostart/sktop ( quodr is the name of the script) to have the script started on each lightdm login: Īs a TODO to myself: I intend to investigate how to start the script as a systemd user service, D-Bus-activated. This way, there will be only 2 processes running: the script itself and gdbus. The exec when running gdbus is not strictly necessary, but it then avoids having an extra process, since the script will fork itself before running gdbus. I didn't think it was relevant to include it. If the script is autostarted with each lightdm login, we'd have potentially multiple instances running, hence the need to kill any current instances before starting.įunction check_quodlibet restarts quodlibet if the mounted USB device (with my music collection) has been reset (it happens randomly after resuming from suspend).
Xfce power manager systemd download#
Download for all available architectures Architecture Package Size Installed Size Files amd64: 188.3 kB: 492. GDBUS_MONITOR="gdbus monitor -system -dest $BUS_NAME -object-path $OBJECT_PATH"įunction kill_running checks if there's an instance running and kills it. rec: libpam-systemd system and service manager - PAM module rec: xfce4-power-manager-plugins power manager plugins for Xfce panel Download xfce4-power-manager.
So, the script skeleton: OBJECT_PATH=/org/freedesktop/login1/session/$XDG_SESSION_ID org/freedesktop/login1/session/c2: .PropertiesChanged ('',, ) Monitoring signals on object /org/freedesktop/login1/session/c2 owned by 1 The script is rather longish, I'll strip anything not-dbus related, to illustrate the point of running a script on screen unlock.įirst a sample output from running gdbus, locking the screen and then unlocking it: gdbus monitor -system -dest 1 -object-path /org/freedesktop/login1/session/c2 Building on Brent Roman's answer, I implemented a script using dbus-monitor and afterwards replaced it with gdbus, which has a cleaner interface and clearer output.