Using Ubuntu 10.10. I use XMonad window manager as primary. I have CommandKey+S mapped to a bash file that shows a screensaver and locks, and puts the PC to sleep (on resume I have to enter password).
#/bin/bash
gnome-screensaver-command -a
gnome-screensaver-command -l
dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
This works fine. However I'd like XMonad to automatically run that script (i.e. lock screen and suspend) after X minutes of no keyboard/mouse activity.
I've taken it (basic screensaver/lock/suspend) for granted in other desktops/windows managers.
Best Answer
You can use xautolock to do this. For example,
This will lock your screen after 1 minute of idle time and will give you a notification (lasting 5 seconds) 10 seconds before it locks. This works fine for me in Xmonad.
To use notify-send you may need to
or something like that. I'm sure you could also substitute out gnome-screensaver for xscreensaver or something else.