Created
April 23, 2011 01:59
-
-
Save iwinux/938151 to your computer and use it in GitHub Desktop.
CPU Temperature Widget for Awesome3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- {{{ shell script: showtemp | |
-- #! /bin/bash | |
-- echo "scale=1; `cat /sys/devices/platform/coretemp.0/temp1_input`/1000" | bc | |
-- }}} | |
function get_cpu_temp() | |
local s = io.popen('showtemp') | |
local temp = s:read() | |
s:close() | |
return temp | |
end | |
function update_cpu_temp(widget) | |
widget.text = "CPU:" .. get_cpu_temp() | |
end | |
mycpuwidget = widget({ type = "textbox", align = "right" }) | |
mycputimer = timer({ timeout = 10 }) | |
mycputimer:add_signal("timeout", function() update_cpu_temp(mycpuwidget) end) | |
mycputimer:start() | |
update_cpu_temp(mycpuwidget) | |
-- NOTE: add mycpuwidget to your widget list (e.g. wibox) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment