macOS: See Next Meeting in Touch Bar
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.
- Open BetterTouchTool, go to
Touch Bar
. Add a widget from bottom menu. - In Select Touch Bar Widget combobox, select
Run Apple Script and Show Return Value
. - 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 clickingRun 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) - Save configurations and in right-most side click Predefined Action
combobox, find and select
Run Apple Script (enter directly as text)
- Paste the same applescript again. Save the configuration.
- You can specify an icon to appear with the widget, it’s on the left side of Select Touch Bar Widget combobox.
- 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.