2020-02-13 12:38:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-04-09 02:01:51 +00:00
|
|
|
# Shows the current moon phase. Requires `pom-perl`.
|
|
|
|
|
2020-05-04 12:07:40 +00:00
|
|
|
mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') || exit 1
|
2020-04-01 14:38:03 +00:00
|
|
|
prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' )
|
2020-02-16 01:11:20 +00:00
|
|
|
case "$mnphs" in
|
2020-04-01 14:38:03 +00:00
|
|
|
"New") icon="🌑" prcnt="0" ;;
|
2020-02-16 01:11:20 +00:00
|
|
|
"Waxing Crescent") icon="🌒" ;;
|
2020-04-01 14:38:03 +00:00
|
|
|
"First Quarter") icon="🌓" prcnt="50" ;;
|
2020-02-16 01:11:20 +00:00
|
|
|
"Waxing Gibbous") icon="🌔" ;;
|
2020-04-01 14:38:03 +00:00
|
|
|
"Full") icon="🌕" prcnt="100" ;;
|
2020-02-16 01:11:20 +00:00
|
|
|
"Waning Gibbous") icon="🌖" ;;
|
2020-04-01 14:38:03 +00:00
|
|
|
"Last Quarter") icon="🌗" prcnt="50" ;;
|
2020-02-16 01:11:20 +00:00
|
|
|
"Waning Crescent") icon="🌘" ;;
|
2020-02-13 12:38:29 +00:00
|
|
|
esac
|
|
|
|
|
2020-05-04 12:07:40 +00:00
|
|
|
case ${BUTTON:-$BLOCK_BUTTON} in
|
2020-04-01 14:38:03 +00:00
|
|
|
1) $mnphs ;;
|
|
|
|
2) $mnphs ;;
|
2020-04-09 02:01:51 +00:00
|
|
|
3) notify-send " 🌜$(pom)" ;;
|
2020-04-01 14:38:03 +00:00
|
|
|
esac
|
|
|
|
|
2020-05-04 12:07:40 +00:00
|
|
|
echo "${icon:?}" "$prcnt"%
|