How to show "time until next scheduled calender" event (in menu bar)

Solution 1:

Here's a way to show the time remaining until the next calendar event in the menu bar.

screenshot of the solution

  1. Install icalBuddy in /usr/local/bin (the easiest way is with Homebrew: brew install ical-buddy)
  2. Download and launch BitBar
  3. Put the following script in the plugin folder you selected (as event.sh, for example):

#!/bin/bash

osascript <<'END'
set theEventInfo to do shell script "/usr/local/bin/icalBuddy -n -li 1 -uid -ec 'Birthdays' -ps '/|/' eventsToday+10 | sed 's/^.*(\\(.*\\)).*uid: \\(.*\\)$/\\1|\\2/'"

set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"|"}
set theEventInfos to every text item of theEventInfo
set AppleScript's text item delimiters to prevDelimiter

set theEventCalendar to first item of theEventInfos
set theEventUID to second item of theEventInfos

tell application "Calendar"
    tell calendar theEventCalendar
        set theEvent to first event whose uid is theEventUID
        set duration to (start date of theEvent) - (current date)
        return "next event in " & duration div hours & ":" & text -2 thru -1 of ("0" & (duration div minutes - (duration div hours * 60))) & return & "---" & return & summary of theEvent & return & start date of theEvent
    end tell
end tell
END

A few notes:

  • There's room for improvements, but the basics are there.
  • It excludes the Birthdays calendar. It also can easily exclude all-day events by adding -ea in icalBuddy's parameters list

Solution 2:

use "Next Meeting" (It's simple and free)