fixed calcurse syncing script for polybar

This commit is contained in:
spinach 2023-02-22 23:49:40 -05:00
parent efd91f41d2
commit 33e21b2be8
3 changed files with 23 additions and 3 deletions

16
bin/calcurse-sync.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
OUTPUT=$(CALCURSE_CALDAV_PASSWORD=$(pass show cal.keegandeppe.com/kdeppe 2>&1) calcurse-caldav 2>&1)
ERRORS=$(echo "$OUTPUT" | grep error)
if [ -n "$ERRORS" ] ; then
polybar-msg action calendar-sync hook 2 1>/dev/null
exit 0
fi
# success, show green for a few seconds and quit
polybar-msg action calendar-sync hook 1 1>/dev/null
sleep 3
polybar-msg action calendar-sync hook 0 1>/dev/null
exit 0

View File

@ -238,10 +238,13 @@ exec = PERCENTAGE=true g703monitor.sh
[module/calendar-sync]
; clickable sync for calendar
type = custom/script
type = custom/ipc
exec = echo -e '\uf073'
click-left = CALCURSE_CALDAV_PASSWORD=$(pass show cal.keegandeppe/kdeppe) calcurse-caldav
hook-0 = echo -e '\uf073'
hook-1 = echo -e '%{F#0F0}\uf274'
hook-2 = echo -e '%{F#F00}\uf273'
initial = 1
click-left = calcurse-sync.sh
[settings]
screenchange-reload = true

View File

@ -1,2 +1,3 @@
- link:
~/.config/calcurse: tui/calcurse
~/.local/bin/calcurse-sync.sh: bin/calcurse-sync.sh