Skip to content

Instantly share code, notes, and snippets.

@iwinux
Created April 23, 2011 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwinux/938151 to your computer and use it in GitHub Desktop.
Save iwinux/938151 to your computer and use it in GitHub Desktop.
CPU Temperature Widget for Awesome3
-- {{{ 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