2020-02-13 12:38:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-05-09 12:35:02 +00:00
|
|
|
# Shows the current moon phase.
|
2020-04-09 02:01:51 +00:00
|
|
|
|
2020-05-09 12:35:02 +00:00
|
|
|
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
|
|
|
|
|
2022-10-08 11:18:04 +00:00
|
|
|
[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
2020-05-16 14:29:28 +00:00
|
|
|
{ curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
|
2020-05-09 12:35:02 +00:00
|
|
|
|
2020-05-16 14:29:28 +00:00
|
|
|
icon="$(cat "$moonfile")"
|
|
|
|
|
|
|
|
case "$icon" in
|
|
|
|
🌑) name="New" ;;
|
|
|
|
🌒) name="Waxing Crescent" ;;
|
|
|
|
🌓) name="First Quarter" ;;
|
|
|
|
🌔) name="Waxing Gibbous" ;;
|
|
|
|
🌕) name="Full" ;;
|
|
|
|
🌖) name="Waning Gibbous" ;;
|
|
|
|
🌗) name="Last Quarter" ;;
|
|
|
|
🌘) name="Waning Crescent" ;;
|
|
|
|
*) exit 1 ;;
|
2020-02-13 12:38:29 +00:00
|
|
|
esac
|
|
|
|
|
2020-05-16 14:29:28 +00:00
|
|
|
echo "${icon-?}"
|
2020-05-09 12:35:02 +00:00
|
|
|
|
2020-05-07 21:31:42 +00:00
|
|
|
case $BLOCK_BUTTON in
|
2020-05-16 14:29:28 +00:00
|
|
|
3) notify-send "🌜 Moon phase module" "Displays current moon phase.
|
|
|
|
- 🌑: New
|
|
|
|
- 🌒: Waxing Crescent
|
|
|
|
- 🌓: First Quarter
|
|
|
|
- 🌔: Waxing Gibbous
|
|
|
|
- 🌕: Full
|
|
|
|
- 🌖: Waning Gibbous
|
|
|
|
- 🌗: Last Quarter
|
|
|
|
- 🌘: Waning Crescent" ;;
|
2020-05-07 21:31:42 +00:00
|
|
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
2020-04-01 14:38:03 +00:00
|
|
|
esac
|