speedwm-personal/modules/module_temp

53 lines
969 B
Plaintext
Raw Normal View History

2022-10-08 14:36:30 +02:00
#!/bin/sh
# cpu temp module for status/stellar
# values
ICON="$1"
BUTTON="$(cat /tmp/speedwm-button)"
# load status config
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
. $HOME/.config/speedwm-de/status/config
if [ "$1" = "" ]; then
ICON="$ITEM8_ICON"
fi
if [ "$ITEM8_FORMAT_CELSIUS" != "true" ]; then
FARG="-F"
fi
fi
2022-10-08 14:36:30 +02:00
if [ ! -e "/tmp/iscelsius" ]; then
if [ "$FARG" = "" ]; then
FARG="-F"
fi
2022-10-08 14:36:30 +02:00
fi
TEMP_FULL="$(sensors $FARG)"
command -v sensors > /dev/null || exit 1
case "$TERMINAL" in
"") TERMINAL=st
esac
# no spacing if there's no icon
if [ "$ICON" != "" ]; then
ICONSPACING=" " # one character spacing
fi
# send the notification
SEND_NOTIF() {
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
notify-send "$FULL_TEMP"
echo "Notification sent successfully!"
echo "INFO: $FULL_TEMP"
exit 0
}
command -v notify-send > /dev/null && SEND_NOTIF
echo "FATAL: libnotify not installed, can't send notification."
exit 1