This is a small utility that prints current system tempreatures to stdout.
It is intended to be used with status bars like Lemonbar or their wrappers,
like succade.
I'm using it to print CPU temperature, which is the common use-case, but the
tool should also be able to query other temperature sensors (chips), if
available. See usage. temp-sensors is generally pretty similar to the
well-known sensors, but tailored for status bars.
temp-sensors uses libsensors to check for available temperature readings.
For this, it iterates available chips and their features, looking for
the chip and feature names given via -c and -f respectively. Temperature
values will be read for all features that match the given feature name, using
strstr() (substring search). The temperature values found this way will be
added up and, at the end, divided by the number of temperature values found.
Only the first chip that matches the given name will be taken into account.
If a reading was obtained, it is printed to stdout, including a newline,
otherwise temp-sensors does nothing.
libsensors
- Make sure
libsensors-devandgccare installed - Run the included
buildscript
temp-sensors [OPTIONS...] -c CHIP -f FEATURE
-euse imperial units instead of metric-hprint usage information, then exit-i INTERVALseconds between checking for a change in value-llist all available chips and their features, then exit-mkeep running and print when there is a visible change in value-p PREVISIONnumber of decimal digits to include in the output-sprint a space between the value and unit-t THRESHOLDrequired change in value in order to print again-uadd the temperature unit to the output
Note that -c and -f currently use strstr() internally, which means the given string will be searched for in the actual chip/feature name. In other words, -c core will match coretemp, as core is a substring of coretemp. Also note that the string comparison is case sensitive, so core is not the same as Core.