Implement module_temp
This commit is contained in:
parent
c853ebb9db
commit
aea19191b5
38
modules/module_temp
Executable file
38
modules/module_temp
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# cpu temp module for status/stellar
|
||||
|
||||
# values
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
if [ ! -e "/tmp/iscelsius" ]; then
|
||||
FARG="-F"
|
||||
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
|
1
mouse.h
1
mouse.h
|
@ -46,4 +46,5 @@ static const StatusCmd statuscmds[] = {
|
|||
{ "module_weather ", 5 },
|
||||
{ "module_net ", 6 },
|
||||
{ "module_dfmpeg ", 7 },
|
||||
{ "module_temp 糖", 8 },
|
||||
};
|
||||
|
|
2
status
2
status
|
@ -168,6 +168,7 @@ esac
|
|||
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
rm -f /tmp/iscelsius
|
||||
|
||||
pkill "$(pgrep -x status | sed "s/$$//g")" # Prevent duplicates
|
||||
|
||||
|
@ -461,6 +462,7 @@ ITEM8() {
|
|||
if [ -e "${BINDIR}sensors" ]; then
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" = "true" ]; then
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors | grep temp1 | awk '{ print $2 }')"
|
||||
touch /tmp/iscelsius
|
||||
else
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors -f | grep temp1 | awk '{ print $2 }')"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue