summaryrefslogtreecommitdiffstats
path: root/.local/bin/statusbar
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-09 08:35:02 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-05-09 08:35:02 -0400
commit26c92f886bb1b52b750727f66c4b5cf2ae910bac (patch)
tree2d6584fdffc0793e470dcda5854f2715d59b9d3d /.local/bin/statusbar
parent33e329c8cb44679c37054d1823ef487c2569fcdc (diff)
downloadeibhear-26c92f886bb1b52b750727f66c4b5cf2ae910bac.tar.gz
eibhear-26c92f886bb1b52b750727f66c4b5cf2ae910bac.tar.zst
eibhear-26c92f886bb1b52b750727f66c4b5cf2ae910bac.zip
moonphase now has no deps
statusbarinfo obsolete and deleted
Diffstat (limited to '.local/bin/statusbar')
-rwxr-xr-x.local/bin/statusbar/moonphase46
-rwxr-xr-x.local/bin/statusbar/statusbarinfo32
2 files changed, 29 insertions, 49 deletions
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