summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-16 10:29:28 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-05-16 10:29:28 -0400
commita00e42e292781e375c02454674155c40aa5e480d (patch)
treee48752232c635f967cae056b75b4fdfe79f515d5 /.local/bin
parent21a29cca4cf4072bc1d2ff1d6e245300728ea3f6 (diff)
downloadeibhear-a00e42e292781e375c02454674155c40aa5e480d.tar.gz
eibhear-a00e42e292781e375c02454674155c40aa5e480d.tar.zst
eibhear-a00e42e292781e375c02454674155c40aa5e480d.zip
Revert "Now moonphase is correct and even more precise (#637)"
This reverts commit 4dbff2873df8e2b13ecff74beb17c32ef3c3267a.
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/statusbar/moonphase38
1 files changed, 23 insertions, 15 deletions
diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase
index e90dc77..fab8b4d 100755
--- a/.local/bin/statusbar/moonphase
+++ b/.local/bin/statusbar/moonphase
@@ -5,25 +5,33 @@
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
- { curl -sf 'https://www.timeanddate.com/moon/phases/' | grep -m1 -o cur-moon-percent.......................................................................................................................................................... > "$moonfile" || exit 1 ;}
+ { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
-mnphs=$( cat $moonfile | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.')
-prcnt=$( cat $moonfile | grep -o "[0-9.0-9]*%" | grep -o "[0-9.0-9]*" )
-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="🌘" ;;
- *) echo 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" "$prcnt"%"
+echo "${icon-?}"
case $BLOCK_BUTTON in
- 3) notify-send "🌜 Moon phase module" "$icon: $mnphs $prcnt" ;;
+ 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