commit 26c92f886bb1b52b750727f66c4b5cf2ae910bac
parent 33e329c8cb44679c37054d1823ef487c2569fcdc
Author: Luke Smith <luke@lukesmith.xyz>
Date: Sat, 9 May 2020 08:35:02 -0400
moonphase now has no deps
statusbarinfo obsolete and deleted
Diffstat:
2 files changed, 29 insertions(+), 49 deletions(-)
diff --git 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
@@ -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