speedwm-personal/modules/module_time
speediegq 122fc050bb Add module system (will add more of these modules tomorrow, add support
for statuscmd to stellar, add more modules to mouse.h
2022-10-08 02:31:35 +02:00

32 lines
631 B
Bash
Executable file

#!/bin/sh
# time module for status/stellar
# values
TIME_SECOND="$(date +%S)"
TIME_MINUTE="$(date +%M)"
TIME_HOUR="$(date +%H)"
TIME_FULL="$(date +%T)"
TIME_ZONE="$(date +%Z)"
ICON="$1"
# no spacing if there's no icon
if [ "$ICON" != "" ]; then
ICONSPACING=" " # one character spacing
fi
# send the notification
SEND_NOTIF() {
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
notify-send "$FULL_TIME"
echo "Notification sent successfully!"
echo "INFO: $FULL_TIME"
exit 0
}
command -v notify-send > /dev/null && SEND_NOTIF
echo "FATAL: libnotify not installed, can't send notification."
exit 1