53 lines
969 B
Bash
Executable file
53 lines
969 B
Bash
Executable file
#!/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
|
|
|
|
if [ ! -e "/tmp/iscelsius" ]; then
|
|
if [ "$FARG" = "" ]; then
|
|
FARG="-F"
|
|
fi
|
|
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
|