Adds icons to notify hour script

This commit is contained in:
Michel Fedde 2025-07-14 23:14:53 +02:00
parent cc918502b1
commit b1e77ed1d6
5 changed files with 39 additions and 3 deletions

View file

@ -1,8 +1,44 @@
#!/bin/env sh
currentHour=$(date +"%H")
ICON_PATH="$HOME/.local/share/icons/hicolor/512x512/apps"
notify-send --icon "amarok_clock" \
ICON_MAP=(
0 6 ${ICON_PATH}/time_moon.png
6 10 ${ICON_PATH}/time_moon_to_sun.png
10 18 ${ICON_PATH}/time_sun.png
18 22 ${ICON_PATH}/time_sun_to_moon.png
22 24 ${ICON_PATH}/time_moon.png
)
HOUR=$(date +"%H")
while [[ $# -gt 0 ]]; do
case $1 in
--time)
HOUR="$2"
shift # past argument
shift # past value
;;
esac
done
icon="amarok_clock"
length=${#ICON_MAP[@]}
for (( i=0; i<length; i += 3 ));
do
if [[ $HOUR -lt ${ICON_MAP[$i]} ]] then
continue
fi
if [[ $HOUR -ge "${ICON_MAP[$i+1]}" ]] then
continue
fi
icon="${ICON_MAP[$i+2]}"
break
done
notify-send --icon "${icon}" \
--app-name="Current Hour" \
"Ding Dong..." \
"It's currently: ${currentHour}:00"
"It's currently: ${HOUR}:00"

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB