diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase index 2d9f91f..fab8b4d 100755 --- a/.local/bin/statusbar/moonphase +++ b/.local/bin/statusbar/moonphase @@ -1,25 +1,37 @@ #!/bin/sh -# Shows the current moon phase. Requires `pom-perl`. +# Shows the current moon phase. -mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') || exit 1 -prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' ) -case "$mnphs" in - "New") icon="πŸŒ‘" prcnt="0" ;; - "Waxing Crescent") icon="πŸŒ’" ;; - "First Quarter") icon="πŸŒ“" prcnt="50" ;; - "Waxing Gibbous") icon="πŸŒ”" ;; - "Full") icon="πŸŒ•" prcnt="100" ;; - "Waning Gibbous") icon="πŸŒ–" ;; - "Last Quarter") icon="πŸŒ—" prcnt="50" ;; - "Waning Crescent") icon="🌘" ;; +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 +echo "${icon-?}" + case $BLOCK_BUTTON in - 1) $mnphs ;; - 2) $mnphs ;; - 3) notify-send " 🌜$(pom)" ;; + 3) notify-send "🌜 Moon phase module" "Displays current moon phase. +- πŸŒ‘: New +- πŸŒ’: Waxing Crescent +- πŸŒ“: First Quarter +- πŸŒ”: Waxing Gibbous +- πŸŒ•: Full +- πŸŒ–: Waning Gibbous +- πŸŒ—: Last Quarter +- 🌘: Waning Crescent" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac - -echo "${icon:?}" "$prcnt"% diff --git a/.local/bin/statusbar/statusbarinfo b/.local/bin/statusbar/statusbarinfo deleted file mode 100755 index 2b3e58c..0000000 --- a/.local/bin/statusbar/statusbarinfo +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -echo " - ____ _ _ _ -/ ___|| |_ __ _| |_ _ _ ___| |__ __ _ _ __ -\___ \| __/ _\` | __| | | / __| '_ \ / _\` | '__| - ___) | || (_| | |_| |_| \__ \ |_) | (_| | | -|____/ \__\__,_|\__|\__,_|___/_.__/ \__,_|_| - -This is a list of the statusbar modules. - -πŸ“¦5 \033[31mpacpackages\033[0m: updatable packages (must have pacman -Sy run in root cronjob to check). -πŸ“° 41 \033[32mnews\033[0m: unread RSS entries in newsboat. -β˜” 83% ❄️ 69Β° 🌞 80Β° \033[33mweather\033[0m: β˜” for precipitation, 🌞 and ❄ for daily high and low. -πŸ“¬ 20 \033[34mmailbox\033[0m: number of unread mail if mutt-wizard is active. -πŸ”‰ 62% \033[35mvolume\033[0m: master sink volume. -πŸ”Œ83% \033[36mbattery\033[0m: πŸ”Œ for charging, πŸ”‹ for discharging, ⚑ for full. -πŸ“Ά 80% ❎ \033[37minternet\033[0m: πŸ“Ά for wifi with % (πŸ“‘ if none), 🌐 for ethernet. (❎ if none). - -Obviously the time and date are displayed as well. - -Optional script modules: - -Edit \033[32m~/.local/src/dwmblocks/config.h\033[0m to add these or your own if you'd like (and recompile and restart dwmblocks). - -'memory' 🧠 559Mi/3.7Gi Current used memory/total memory. -'cpu' 🌑 +46.0Β°C CPU temperature. -'disk' πŸ–₯ : 28G/30G Remaining disk space... -'disk ~' 🏠: 641G/850G ...can be given directory argument. -'moonphase' πŸŒ• 39% Phase of the moon (requires \033[32m\`pom-perl\`\033[0m). -'iplocate' πŸ‡ΊπŸ‡Έ United States Your own or VPN location (requires \033[32m\`geoiplookup\`\033[0m). -" | less