I took a few hours to revive an old project. It had stopped working on modern machines, and despite its limited usefulness, it fit a need for me and I want to get an updated version out there.
Sure, it took way longer to fix and deploy than it was worth, and I
ended up going another direction in the script I was writing at the
time, but it was fun and just enough challenge to keep my mind busy on my holiday break.
This is a revival of beengone 1.0, a simple little tool that just tells you how long your computer has been idle (no input from
keyboard or mouse). Version 2.0 not only gets that working again, it
adds some command line flags that are designed to make scripting
easier.
For example, it has a --minimum XXX
flag that can take an integer or interval string like 3h30m
and will provide an exit code based on whether that threshold has been met. That’s perfect for looping in a background script and only moving on when it returns a 0 exit code. But wait, there’s more.
There’s also a --wait XXX
flag that takes the same input, but
blocks the script until the threshold is met, bypassing the need for while true
loops when you don’t actually need them (when nothing else needs to happen on each iteration).
It can even simulate a mouse click with --input
, which will reset the timer, and possibly wake up your machine. I haven’t tested that much.
There are a few simple example scripts on the beengone project page. If you do anything cool with this, please let me know. My assumption is that nobody will have an immediate need for it, so surprise me. Maybe someday the need will arise and you’ll stumble back upon it in a web search.
beengone
works while your screensaver is on if it’s running in the
background, either in a background shell script or as a launchd
process. It should also work when your machine is sleeping, or upon wake with launchd, but almost definitely not in hibernate mode. But if you want a script that, say, stops a timer when you’re not using your Mac for five minutes, this is your tool.
Side note, the hardest part of these binary command line utilities is distribution. You can’t sign a lone binary outside of an app bundle, so you have to put it in a PKG file. And you have to sign the binary with a development ID within the PKG, but you also have to sign the PKG with an installer ID. Two different certificates to install a 94k binary, and without it the tool just won’t run. It’s a pain, but I also get exactly how risky downloading unknown binary files from the internet is, so I appreciate the level of security. Hopefully I got it right.
I’ve automated the process at this point, so I can just run howzit -r deploy
and the tool will be tested, built, packaged, signed, notarized, and uploaded to a tagged release on GitHub, which is what the download link then points to. The project page and GitHub README get updated as part of the build process, too.
Anyway, please use it if you need it, and tip your server if you think they deserve it.
Here’s the link to the project page again, and you can see all the source code on GitHub.
Happy holidays, happy Solstice, happy Hanukah, merry Christmas, happy Kwanza, and you know, whatever you’re into. Enjoy the cozy evenings in the darkest time of year. (In the norther hemisphere, anyway. I don’t know what Australians get up to this time of year.)