The Pomodoro Technique is a way to enhance focus while working. There is a high cost in brainpower to stop doing what you are focused on, look at the tweet that just came in, and then try to start up where you left off. The idea of working in “pomodoros” is that you work uninterrupted for 25 minutes. Then you get a 5 minute break. After you do 4 of those cycles, you get a 10 minute break. Speaking from my own experience, I get a lot more done in 4 hours of pomodoros than 8 hours of work disrupted by various notifications.
At Work Market, we rely on HipChat to communicate with each other throughout the day. This is a very handy way to connect our two offices and the various remote workers that we may have at any given time. However, when I am in a pomodoro, I don’t want to be disturbed by HipChat.
Following the excellent post here, I am able to automatically set my status to “Do Not Disturb” when I start a pomodoro and back to “Available” when the pomodoro is done.
I’ve taken it one step further by sending a notification to the main room we all use in HipChat to let my coworkers know what I am up to. This is a little more communicative than just having my status abruptly change with no other context.
The key is making use of the HipChat API in conjunction with AppleScript.
Firstly, I created a shell script named HipChat.Pomodoro.sh that takes a message as an argument and sends it to the specified HipChat room using the API:
1
2
3
4
5
6
7
8
#! /bin/bash
ROOM_ID=[HipChat Room ID]
AUTH_TOKEN=[HipChat Auth Token]
MESSAGE=$1
curl -s \
-d "room_id=$ROOM_ID&from=Pomodoro¬ify=1&color=yellow&message_format=text" \
--data-urlencode "message=(pomodoro) $MESSAGE" \
https://api.hipchat.com/v1/rooms/message?auth_token=$AUTH_TOKEN > /dev/null
You’ll need to put in your own room id and auth token from HipChat.
You can test this right from the command line:
Next, I updated the settings in the Pomodoro app preferences to make use of the script:
I added the call to my script after the AppleScript from Sean’s original post. I have the Start, Interrupt Over, Reset and End events handled
Start:
1
2
3
4
5
6
7
tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
perform action "AXShowMenu"
delay 0.5
click menu item "Status" of menu 1
click menu item "Do Not Disturb" of menu 1 of menu item "Status" of menu 1
end tell
do shell script "/Users/dogeared/Hipchat.Pomodoro.sh 'Micah is starting a Pomodoro. He will be back in 25 minutes.'"
Interrupt Over:
1
2
3
4
5
6
7
tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
perform action "AXShowMenu"
delay 0.5
click menu item "Status" of menu 1
click menu item "Available" of menu 1 of menu item "Status" of menu 1
end tell
do shell script "/Users/dogeared/HipChat.Pomodoro.sh 'Too many distractions. (pomodoro) fail for Micah!'"
Reset:
1
2
3
4
5
6
7
tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
perform action "AXShowMenu"
delay 0.5
click menu item "Status" of menu 1
click menu item "Available" of menu 1 of menu item "Status" of menu 1
end tell
do shell script "/Users/dogeared/HipChat.Pomodoro.sh 'Micah bailed! (timeforthat)'"
End:
1
2
3
4
5
6
7
tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
perform action "AXShowMenu"
delay 0.5
click menu item "Status" of menu 1
click menu item "Available" of menu 1 of menu item "Status" of menu 1
end tell
do shell script "/Users/dogeared/HipChat.Pomodoro.sh 'And... Micah is back! (thumbsup)'"
Note: The Pomodoro app’s script tab in preferences is finicky. The standard copy-and-paste shortcut keys do not work, but right-clicking and choosing copy or paste does work.
You will need to enable access for assistive devices in System Preferences -> Accessibility in order for the Pomodoro automation to work.
Here are some screenshots from HipChat. In the first one, I started a pomodoro and reset in the middle of it. The second one shows a complete pomodoro.