From 33e21b2be86025b50afce1c4068956679e638430 Mon Sep 17 00:00:00 2001 From: spinach <19keegandeppe@gmail.com> Date: Wed, 22 Feb 2023 23:49:40 -0500 Subject: [PATCH] fixed calcurse syncing script for polybar --- bin/calcurse-sync.sh | 16 ++++++++++++++++ gui/polybar/config.ini | 9 ++++++--- meta/configs/calcurse.yaml | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 bin/calcurse-sync.sh diff --git a/bin/calcurse-sync.sh b/bin/calcurse-sync.sh new file mode 100755 index 0000000..f372436 --- /dev/null +++ b/bin/calcurse-sync.sh @@ -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 diff --git a/gui/polybar/config.ini b/gui/polybar/config.ini index 26ad566..27c2e04 100644 --- a/gui/polybar/config.ini +++ b/gui/polybar/config.ini @@ -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 diff --git a/meta/configs/calcurse.yaml b/meta/configs/calcurse.yaml index 3dd574b..27d9aa0 100644 --- a/meta/configs/calcurse.yaml +++ b/meta/configs/calcurse.yaml @@ -1,2 +1,3 @@ - link: ~/.config/calcurse: tui/calcurse + ~/.local/bin/calcurse-sync.sh: bin/calcurse-sync.sh