Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|improve this question
up vote 8 down vote accepted

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|improve this answer
Is there a way to tell xfce4 to run xscreensaver in the described way and have a script listen to its output? – KB22 Jan 2 '15 at 17:18
Found it, nevermind. bbs.archlinux.org/viewtopic.php?pid=1182514 – KB22 Jan 2 '15 at 17:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.