taskwarrior: Add auto-syncing script

Let taskwarrior automatically sync any changed tasks whenever a process
is completed.
Will sync 'asynchronously' (start the job as a terminal background
process) and show the sync message after it is done.
This commit is contained in:
Marty Oehme 2021-07-09 22:23:08 +02:00
parent 1d66b763cb
commit c578a1bebc
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 18 additions and 2 deletions

View file

@ -67,7 +67,7 @@ taskd.ca=~/.local/share/task/keys/freecinc_7ebc40a3.ca.pem
taskd.credentials=FreeCinc\/freecinc_7ebc40a3\/1b2f5c1e-3d62-4a35-82c8-82ce0e23731e taskd.credentials=FreeCinc\/freecinc_7ebc40a3\/1b2f5c1e-3d62-4a35-82c8-82ce0e23731e
# Color theme (uncomment one to use) # Color theme (uncomment one to use)
#include /usr/share/doc/task/rc/light-16.theme include /usr/share/doc/task/rc/light-16.theme
#include /usr/share/doc/task/rc/light-256.theme #include /usr/share/doc/task/rc/light-256.theme
#include /usr/share/doc/task/rc/dark-16.theme #include /usr/share/doc/task/rc/dark-16.theme
#include /usr/share/doc/task/rc/dark-256.theme #include /usr/share/doc/task/rc/dark-256.theme
@ -78,7 +78,7 @@ taskd.credentials=FreeCinc\/freecinc_7ebc40a3\/1b2f5c1e-3d62-4a35-82c8-82ce0e237
#include /usr/share/doc/task/rc/dark-yellow-green.theme #include /usr/share/doc/task/rc/dark-yellow-green.theme
#include /usr/share/doc/task/rc/dark-gray-256.theme #include /usr/share/doc/task/rc/dark-gray-256.theme
#include /usr/share/doc/task/rc/dark-gray-blue-256.theme #include /usr/share/doc/task/rc/dark-gray-blue-256.theme
include /usr/share/doc/task/rc/solarized-dark-256.theme #include /usr/share/doc/task/rc/solarized-dark-256.theme
#include /usr/share/doc/task/rc/solarized-light-256.theme #include /usr/share/doc/task/rc/solarized-light-256.theme
#include /usr/share/doc/task/rc/no-color.theme #include /usr/share/doc/task/rc/no-color.theme

View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
# This hooks script syncs task warrior to the configured task server.
# The on-exit event is triggered once, after all processing is complete.
# Make sure hooks are enabled
# Count the number of tasks modified
n=0
while read -r REPLY; do
n=$((n + 1))
done
if [ $n -gt 0 ]; then
SAVELOC="${XDG_DATA_HOME}/task"
task sync >>"${SAVELOC:-~/.task}/sync_hook.log" &
fi