2019-04-10 00:34:41 +00:00
|
|
|
#! /bin/bash
|
2019-11-14 01:22:48 +00:00
|
|
|
set -o pipefail
|
2019-04-10 00:34:41 +00:00
|
|
|
|
2019-11-14 01:22:48 +00:00
|
|
|
# Prints out whatever calendar event is on right now with spacers around it for
|
|
|
|
# my tmux status line
|
2019-04-10 00:34:41 +00:00
|
|
|
|
2019-11-14 01:22:48 +00:00
|
|
|
# Make sure we have a calendar to use
|
|
|
|
if [ -z "$TMUX_ICAL" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2019-04-10 00:34:41 +00:00
|
|
|
|
2019-11-14 01:22:48 +00:00
|
|
|
if command -v icalBuddy &>/dev/null ;then
|
|
|
|
# -li 1: limit 1
|
|
|
|
# -nc: no calendar name
|
|
|
|
# -ic <cal>: include only this calendar
|
|
|
|
# -b '': use empty string instead of bullet
|
|
|
|
# head: take first line since second includes times
|
|
|
|
event_name=$(icalBuddy -li 1 -nc -ea -ic "$TMUX_ICAL" -b '' eventsNow | head -n 1)
|
|
|
|
|
|
|
|
# If event is found, echo it back with spacers around it for tmux
|
|
|
|
if [ -n "$event_name" ]; then
|
|
|
|
echo " $event_name |"
|
|
|
|
fi
|
|
|
|
fi
|