Temp widget: the reason to use "find" command
kdrobnyh opened this issue · 1 comments
kdrobnyh commented
I looked into your code and have a question: why do you query the temperature sensors in the system if you can just read from the specified file if it exists?
lcpz commented
Your question can be answered by reading the wiki. I will try to elaborate here as well.
Which is the specified file? Different OSs may use different locations and file names for the temperature file(s).
That's why I find
them all.
If you want to just cat a file you know it exists on your computer, you can use a watch
:
local bitcoin = awful.widget.watch(
"cat '/sys/devices/virtual/thermal/thermal_zone0/temp'", -- TODO modify accordingly
30, -- poll asynchronously every 30 seconds
function(widget, stdout)
local text = stdout -- TODO process here
widget:set_markup(text)
end
)