How do you use your computer to help enforce better working habits?
One “trick” that I have used it setting “working hours” for certain apps. If I try to use those apps outside of those hours, Keyboard Maestro will simply quit the app and put up a notification telling me I’m not allowed to work now.
I’ve even expanded this idea to enforce a “weekend” (although for me that means Friday and Saturday) by not allowing those apps to run at any time on those days.
Define Triggers
You can set these to be anything you want, but I decided to two applications which I use exclusively for work: MailMate and OmniFocus:
This macro will be triggered whenever either of those apps are “activated” which (in Keyboard Maestro parlance) means either when they are launched or if they are already running when I switch to them, aka using ⌘Tab or Alfred, etc.
Check the Current Hour and Current Day
These two variables get set to the current hour and current day…
…so we can compare them to the current time and day.
When those apps activate, Keyboard Maestro checks %ICUDateTime%HH%
which tells it what hour of the day it is (00-23) and %ICUDateTime%eeee%
what day of the week it is, using the full names for each day (Sunday Monday Tuesday Wednesday Thursday Friday Saturday). I could use other ways to refer to specific days of the week, but I prefer the full names for clarity. I don’t want to have to remember if the week starts on Sunday or Monday with 0 or 1, and is Friday day 5 or day 6?
Names are easier. Use names.
Define Your “Off” Hours and Days
I chose to tell Keyboard Maestro what hours I am not “supposed” to be working.
Here are the days and hours that I chose for “Not Working”:
You’ll notice that setting the “off” hours as 00|01|02|03|04|05|06|07|08|18|19|20|21|22|23
allows me to work from 9:00 a.m. local time to 5:59 p.m. local time (because hour “18” is 6:00 p.m.) I did not define working “minutes” so I had to end my work day at a specific hour, as opposed to, say 6:30 p.m.
I also told Keyboard Maestro that I should not be working on Friday or Saturday (as a pastor, “working” on Sunday is kind of required).
Quit
Quitting the front-most app should quit either OmniFocus or MailMate, as the trigger for this is that app activating.
There’s another way to quit the app (which is ‘greyed out’ below, I left it just for illustration purposes) and then there’s a sound an a notification:
Voilà!
Download
If you want to play with this, feel free to download the macro and play around with it.