Xorg configuration hook for unblank screen

screensaverx11xorg

Is is possible to execute a command automatically when X comes out of a power saving screen blank? I.e., something that would be triggered when I hit a key/move the mouse to power up the display again?

Best Answer

X11 has a screensaver extension which offers a notification API for the blanking and unblanking of the display (including dpms events). Tools like xssstart (https://github.com/unixdj/xssstart) use this API to run a command as soon as the screen is blanking. But you also can catch the 'unblank' event to run a command then.

All you have to do is change the event it triggers in line 90 (https://github.com/unixdj/xssstart/blob/master/xssstart.c#L90)

from state == ScreenSaverOn to state == ScreenSaverOff

and you have your xssstop tool

Related Question