Skip to content

Instantly share code, notes, and snippets.

View moehrenzahn's full-sized avatar

Max Melzer moehrenzahn

View GitHub Profile
# This is an action script for TextBar corresponding to this gist: https://gist.github.com/moehrenzahn/6e29d3080edb6466db7b
# By Max Melzer
open /Applications/Calendar.app; # If any line of the list is clicked, open the default Calendar app.
# The following code begins a multi-line applescript. The repeat loop makes sure that the script waits until Calendar has finished opening.
osascript -e '
set calendarDidFinishLaunching to false
repeat while calendarDidFinishLaunching is false
# A calendar script for use with TextBar (http://www.richsomerfield.com/apps/)
# by Max Melzer
# Explanation here: http://www.moehrenzahn.de/Ein-Menueleisten-Kalender-mit-TextBar/
export LC_ALL=de_DE.UTF-8; # Set the language of the virtual shell to german. This makes the following "date" command output german day and month names. If you want the date in english, you dont need this line
date '+%a, %-d. %B %-H:%M'; # This outputs the current date, according to the unix "date" command. The Output becomes the first line in the finished menu bar app – the title that is always displayed (this makes the default menu bar clock redundant. Remove it by CMD-dragging). The refresh rate of the TextBar script should be at least be set to something like every 10 seconds so the time is always up to date.
DAY=$(date '+%e') # We save the current day as a variable to highlight the corresponding day in the month overview.
# The following piece of code is a bit of a monstrosity. At its heart lies the unix "cal" command which