#!/bin/sh # Shows the current moon phase. moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} 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 ;; esac icon="$(ico $icon)" || icon="?" echo "$icon" case $BLOCK_BUTTON in 3) notify-send "$(ico 🌘) Moon phase module" "Displays current moon phase. - $(ico 🌑): New - $(ico 🌒): Waxing Crescent - $(ico 🌓): First Quarter - $(ico 🌔): Waxing Gibbous - $(ico 🌕): Full - $(ico 🌖): Waning Gibbous - $(ico 🌗): Last Quarter - $(ico 🌘): Waning Crescent" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac