I'd like to run a screen if the Gnome session is locked and unlocked. Is there a way that I can intercept this and perform certain actions when the desktop is locked or unlocked?
|
Gnome-screensaver emits some signals on dbus when something happens. Here the documentation (with some examples). You could write a scripts that runs:
and that does what you need anytime Here a bash command to do what you need:
Just replace |
|||||||||||||||||||||
|
|
In ubuntu 14.04 the DBus event for screen lock unlock has changed and the new script for binding to screen lock and unlock events looks like the following
|
|||||||||||||
|
|
Ubuntu 16.04: ozma’s solution did not work for me, however this one did:
|
|||||
|
|
If you're on Kubuntu or using KDE / Plasma as your Desktop Environment, you have to listen for the interface
|
|||
|
|
|
Expanding on already given answer. If you try to run a script from inside a
If this doesn't work for you, it's probably because:
|
|||||||||
|
|
this is what worked for me in ubuntu 16.04
|
|||