mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-11-21 16:26:30 +00:00
Make cal_now a little more flexible
This commit is contained in:
parent
00d63f5925
commit
41483058c4
@ -1,7 +1,24 @@
|
||||
#! /bin/bash
|
||||
set -o pipefail
|
||||
|
||||
# Prints out whatever calendar event is on right now
|
||||
# Prints out whatever calendar event is on right now with spacers around it for
|
||||
# my tmux status line
|
||||
|
||||
cal_name=ifij@yelp.com
|
||||
# Make sure we have a calendar to use
|
||||
if [ -z "$TMUX_ICAL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
icalBuddy -li 1 -nc -ea -ic $cal_name -b '' eventsNow | head -n 1 | sed 's/^/ /' | sed 's/$/ |/'
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user