One thing I’ve written about before is the problem of Compulsive Internet Use before. One thing I’ve tried in the past to deal with is was my Shutdown Nag. This, at the time, was a quick extension to my Window Manager which would lock the computer at a preset time and then give me the opportunity to save my work before shutting the computer down for the night. It worked reasonably well, but I’ve since changed the window manager I use from Stumpwm to Xmonad and the old tool no longer works. I’ve since intended to replace it with a similar window manager agnostic tool, but hadn’t the will to actually go through the effort to write it, until now.
My new program, Nighttime-Alert is a quick C program, which I hacked together initially by retooling code from dmenu. Then I skimmed some actually docs on how to use XLib and made it work in the way that I wanted. That way is this:
- The program is triggered by cron to start to start at 10:00 PM. (It can be made to start at anytime, but I chose 10:00 PM)
- The program locks the keyboard and mouse and flashes a message announcing that the computer will shutdown soon.
- I can then press escape to make the message go away and save my work.
- The message returns every 3 minutes.
- At 10:30 PM, the program locks the keyboard and mouse again and shuts down the computer. (The shutdown time is set with a CLI option in the cron job)
Simple and it keeps me from accidentally browsing the Internet past my (self-imposed) bedtime. Also, it looks kinda cool:
For those who want to try it themselves, it’s on Github and it should be a breeze to compile and run. The only requirements are that it run on a Linux computer running X Windows and systemd, so most of them. 1
- It can be made to work without systemd trivially, but I haven’t done so. Patches are welcome. ↩