Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
931 B

  1. #! /bin/sh
  2. icon=
  3. events=$(calcurse -a | grep -- '->' | wc -l)
  4. if [ ! "$events" = "0" ]; then
  5. events="($events) "
  6. else
  7. events=""
  8. fi
  9. cmd=$(date +"%h%e")
  10. echo -n "^c#0f111a^^b#88c0d0^ $icon $events$cmd ^d^"
  11. case $BLOCK_BUTTON in
  12. 1) setsid -f st -c center -n center -e calcurse;;
  13. esac
  14. next=$(calcurse -n | tail -1)
  15. if [ ! "$next" = "" ]; then
  16. name=$(echo "$next" | cut -d ' ' -f 5- -)
  17. time_left=$(date --date="$(echo "$next" | cut -d '[' -f2 | cut -d ']' -f1 )" "+%k%M")
  18. if [ "$time_left" -lt 7 ]; then
  19. if [ ! -f "$XDG_CACHE_HOME/calcurse" ];then
  20. touch "$XDG_CACHE_HOME/calcurse"
  21. fi
  22. if [ "$(grep "$name" "$XDG_CACHE_HOME/calcurse")" = "" ]; then
  23. time=$(calcurse -a | grep -E "\s*$name\$" -B 1 | head -n 1 | cut -c4-8)
  24. echo "$name" > "$XDG_CACHE_HOME/calcurse"
  25. canberra-gtk-play -i bell -V 20
  26. dunstify -a " Event approaching" "[$time] $name"
  27. fi
  28. fi
  29. fi