28 lines
		
	
	
		
			963 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			963 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
#
 | 
						|
# This is an example hook. It does two things whenever you save the data files:
 | 
						|
#
 | 
						|
# 1. Make a commit if the calcurse directories contain a Git repository.
 | 
						|
# 2. Synchronize with a CalDAV server if calcurse-caldav is configured.
 | 
						|
#
 | 
						|
# In order to install this hook, copy this file to
 | 
						|
# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or
 | 
						|
# ~/.calcurse/hooks/ if using ~/.calcurse.
 | 
						|
 | 
						|
data_dir="$HOME/.local/share/calcurse"
 | 
						|
config_dir="$HOME/.config/calcurse"
 | 
						|
 | 
						|
# Do not do anything when synchronizing with a CalDAV server.
 | 
						|
[ -f "$data_dir/caldav/lock" ] && exit
 | 
						|
 | 
						|
# Optionally run the CalDAV synchronization script in the background.
 | 
						|
cd "$data_dir" || exit
 | 
						|
if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then
 | 
						|
	(
 | 
						|
		date="$(date +'%b %d %H:%M:%S')"
 | 
						|
		echo "$date Running calcurse-caldav from the post-save hook..."
 | 
						|
        CALCURSE_CALDAV_PASSWORD=$(pass show cal.keegandeppe.com/kdeppe) calcurse-caldav
 | 
						|
		echo
 | 
						|
	) >>caldav/log 2>&1 &
 | 
						|
fi
 |