xscreensaver: How do I run a script on unlock?

5,158

xscreensaver has a -watch option:

-watch    Prints a line each time the screensaver changes state: when the screen blanks, locks, unblanks, or when the running hack is changed. This option never returns; it is intended for use by shell scripts that want to react to the screensaver in some way.1

The UNBLANK state is what you are looking for. The manual includes an example script using these options.

1. http://www.jwz.org/xscreensaver/man3.html

Share:
5,158

Related videos on Youtube

Matthew Ruddy
Author by

Matthew Ruddy

Updated on September 18, 2022

Comments

  • Matthew Ruddy
    Matthew Ruddy almost 2 years

    I'd like to run a screen if the XFCE 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?

    I see that it is possible in Ubuntu; but I'd like to achieve this in Xubuntu.

    I can't seem to find any events triggered by xscreensaver when it quits...

  • KB22
    KB22 over 9 years
    Is there a way to tell xfce4 to run xscreensaver in the described way and have a script listen to its output?