
For a long time, I was trying to figure out the best way to work and take breaks. I tend to work and work and work and forget to take breaks, and sometimes the other extreme kicks in: I just can’t get started.
I’ve tried countless Pomodoro timer apps, and even physical timers on my desk, but nothing has been as helpful as a custom timer app. Enter Hammerspoon for Mac. If you have Windows, I don’t know how to help you since Hammerspoon is only for Mac, but you might try AutoHotkey. When I get a new job and have a Windows machine again, I may loop back on this, but hopefully this post gives you some ideas, even if you don’t have a Mac to do this exact thing.
By the way, I’m not taking credit for learning how to program with Lua. I vibecoded this with ChatGPT. But it’s pretty straightforward stuff if you know any other programming languages.
Setting up Hammerspoon
You install Hammerspoon and access it from your menu bar in the upper right.

If you choose Open config, it will do just that in a text editor.
I wanted a few things specifically:
- A timer, obviously, but with other timers it was too easy to restart it or stop it mindlessly.
- An automatic timer that starts when I unlock my computer, with different timer lengths for different days/times. In this case, off work hours gives me 10 minutes before alerting, but during work hours I let it run for 30 minutes.
- Vacation mode. I can change the mode if I’m on vacation and I’m at home, so then it’s always 10 minutes on the timer.
- Ask what I’m doing and force me to type more than 10 characters. This way, I’m actually thinking about what I’m doing and whether I need to keep doing this now. Do I need a break?
- Log what I’m doing. I haven’t reviewed the log yet, but I would like to run analytics on it at some point to see what the heavy hitters are.
I’ve gotten really good at figuring out how long 10 and 30 minutes really are, and I lock my computer before they happen a plenty these days, so then I’m not “forced” to type out a measly 10 characters. Oh, how clever my mind is. But it does also “force” me to realize that it’s a good time to take a break, which invariably happens when I close the lid or lock my computer.
I’m not so sneaky as to lock it and then immediately reopen it — yet. And who am I fooling or cheating if I did that? Only myself. But who do we fool the most? I wasn’t planning to make this a philosophical treatise, but you know…
I could always quit Hammerspoon, and that completely ends the timer, but I don’t usually do that. I am looking for a new job lately, and even during interviews it pops up. It’s a good reminder about how much time I spend on that, too.
So, onto the code, which is the part Chatty helped me with. It kind of explains itself here in GitHub.
How it looks
Below is the 30-minute check popup. The same thing applies with the 10-minute check. I used to have a stop button or lock button, but I didn’t want to stop the timer, and I didn’t want to grant elevated perms to Hammerspoon to lock my computer for me.

And this is how it looks in the menu bar, so you can always see how much time is left.

This has really helped me to be more aware. And I won’t really change if I’m not aware of the habits in the first place. I could probably list off the top of my head what is in the log of my 10 character ramblings, but I will peruse it some day soon to be sure. I’m brainstorming ideas for the longer-term analytics portion, so that will be for another blog post.
Hope this post helps someone else, but if nothing else, it documents this for my future self, and I love helping my future self!
