summaryrefslogtreecommitdiff
path: root/.config/calcurse/hooks/pre-load
blob: dc257711cfd754eb41102a87314ef93e9695ee9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
[ -d "$HOME/.calcurse" ] && data_dir="$HOME/.calcurse" || data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse"

cd "$data_dir" || exit

# Do not do anything when synchronizing with a CalDAV server.
[ -f caldav/lock ] && exit

# Run the CalDAV synchronization script in the background.
if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then
	(
		date="$(date +'%b %d %H:%M:%S')"
		echo "$date Running calcurse-caldav from the pre-load hook..."
		CALCURSE_CALDAV_PASSWORD=$(pass web/radicale.chudnick.com | head -1) calcurse-caldav
		echo
	) >>caldav/log 2>&1 &
fi