Nvidia-settings Widget

For those using Nvidia's Linux binary driver, it is possible to use the nvidia-settings program to query GPU temperature, performance level, and other statistics for use in widgets.

nvidia-settings
The basic syntax for querying a property is: nvidia-settings -q -t

A list of all GPU-related properties can be acquired by running: nvidia-settings -q all | grep "Attribute 'GPU"

Example
It is trivial to capture the output of an nvidia-settings command and display it in a widget. This simple example displays the current GPU core temperature and PowerMizer performance level. -- GPU widget gpuwidget = widget({ type = "textbox" }) function update_nvidia perf = io.popen("nvidia-settings -q gpucurrentperflevel -t", "r") temp = io.popen("nvidia-settings -q gpucoretemp -t", "r") gpuwidget.text = " gpu lvl " .. perf:read .. ", " .. temp:read .. "C " perf:close temp:close end awful.hooks.timer.register(3, function update_nvidia end) update_nvidia