In this blogpost, I will show how you can display the next meeting you have in Calendar app with BetterTouchTool. In the end you will have a widget like this:

Requirements

  • BetterTouchTool: It enables us to add buttons and widgets to the touchbar.
  • icalBuddy: This command line tool finds & returns calendar events.

I use homebrew, so I installed these tools with following commands:

brew cask install bettertouchtool
brew install ical-buddy

You can download both of them from their webpages if you don’t want to use homebrew.

Proof of Concept

You can run ical-buddy in terminal to see upcoming events today with this command:

/usr/local/bin/icalBuddy -n -npn -nc -iep "title,datetime" -ps "|=|" -po "datetime,title" \
  -tf "=%H.%M" -df "" -eed eventsToday+ | head -n 1 | awk -F "=" '{print substr($2,0,5)" : "$3}'

Note: If you have downloaded icalBuddy manually, you should change the path of icalBuddy in the command.

Accompanied to the screenshot above, I see this output:

20.00 : Visit at Rıdvan's

Now we will use this output to create a touchbar widget.


  1. Open BetterTouchTool, go to Touch Bar. Add a widget from bottom menu.
  2. In Select Touch Bar Widget combobox, select Run Apple Script and Show Return Value.
  3. Below this combobox, click Advanced Configuration and paste below applescript to the editor. The name is up to you, mine is next meeting. You can see output of the script by clicking Run Script button. You can also make color modifications to the widget here. And you can specify how often this script will run to update the widget (the slider specifies this duration)
  4. Save configurations and in right-most side click Predefined Action combobox, find and select Run Apple Script (enter directly as text)
  5. Paste the same applescript again. Save the configuration.
  6. You can specify an icon to appear with the widget, it’s on the left side of Select Touch Bar Widget combobox.
  7. I added an additional behavior to the widget, so when clicked it opens Calendar app. In the bottom menu, there is Attach Additional Action button. Click it and choose Open Application / File / Apple Script... option. You can find Calendar app under /Applications directory.
AppleScript: ```applescript set eventsToday to do shell script "/usr/local/bin/icalBuddy -n -npn -nc -iep \"title,datetime\" -ps \"|=|\" -po \"datetime,title\" -tf \"=%H.%M\" -df \"\" -eed eventsToday+ | head -n 1 | awk -F \"=\" '{print substr($2,0,5)\" : \"$3}'" if eventsToday is not "" then return eventsToday else return "no events today" end if ``` You can specify how many days further you want to check for events. In the command, `eventsToday+` means just look for the next day. If you change it as `eventsToday+5` the command will check the next 5 days.