summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-04 08:07:40 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-05-04 08:07:40 -0400
commit4920a1b363b6b321204938d5f8d664f83e1ebbaf (patch)
treef68c1833356882c00a5f947d58555406a04753a6 /.local
parent1c79c00208b4dda46d068924ca70a67074360e50 (diff)
downloadeibhear-4920a1b363b6b321204938d5f8d664f83e1ebbaf.tar.gz
eibhear-4920a1b363b6b321204938d5f8d664f83e1ebbaf.tar.zst
eibhear-4920a1b363b6b321204938d5f8d664f83e1ebbaf.zip
moonphase won't run if pom-perl not installed
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/statusbar/moonphase7
1 files changed, 3 insertions, 4 deletions
diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase
index 12ed90b..739b8a8 100755
--- a/.local/bin/statusbar/moonphase
+++ b/.local/bin/statusbar/moonphase
@@ -2,7 +2,7 @@
# Shows the current moon phase. Requires `pom-perl`.
-mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.')
+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" ;;
@@ -13,13 +13,12 @@ case "$mnphs" in
"Waning Gibbous") icon="🌖" ;;
"Last Quarter") icon="🌗" prcnt="50" ;;
"Waning Crescent") icon="🌘" ;;
- *) echo errorrrr ;;
esac
-case $BLOCK_BUTTON in
+case ${BUTTON:-$BLOCK_BUTTON} in
1) $mnphs ;;
2) $mnphs ;;
3) notify-send " 🌜$(pom)" ;;
esac
-echo "$icon" "$prcnt"%
+echo "${icon:?}" "$prcnt"%