Skip to main content
1 of 4
peoro
  • 4k
  • 3
  • 35
  • 32

gnome-screensaver emits some signals on dbus when something happens.

Here the documentation (with some examples).

You could write a scripts that runs:

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'"

and that does what you need anytime dbus-monitor prints a line about the screen locked/unlocked.

peoro
  • 4k
  • 3
  • 35
  • 32