moonphase won't run if pom-perl not installed
This commit is contained in:
parent
1c79c00208
commit
4920a1b363
1 changed files with 3 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Shows the current moon phase. Requires `pom-perl`.
|
# 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:]]*' )
|
prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' )
|
||||||
case "$mnphs" in
|
case "$mnphs" in
|
||||||
"New") icon="🌑" prcnt="0" ;;
|
"New") icon="🌑" prcnt="0" ;;
|
||||||
|
@ -13,13 +13,12 @@ case "$mnphs" in
|
||||||
"Waning Gibbous") icon="🌖" ;;
|
"Waning Gibbous") icon="🌖" ;;
|
||||||
"Last Quarter") icon="🌗" prcnt="50" ;;
|
"Last Quarter") icon="🌗" prcnt="50" ;;
|
||||||
"Waning Crescent") icon="🌘" ;;
|
"Waning Crescent") icon="🌘" ;;
|
||||||
*) echo errorrrr ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $BLOCK_BUTTON in
|
case ${BUTTON:-$BLOCK_BUTTON} in
|
||||||
1) $mnphs ;;
|
1) $mnphs ;;
|
||||||
2) $mnphs ;;
|
2) $mnphs ;;
|
||||||
3) notify-send " 🌜$(pom)" ;;
|
3) notify-send " 🌜$(pom)" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "$icon" "$prcnt"%
|
echo "${icon:?}" "$prcnt"%
|
||||||
|
|
Loading…
Reference in a new issue