lain icon indicating copy to clipboard operation
lain copied to clipboard

Create NVIDIA GPU usage/temperature widget

Open tronfy opened this issue 2 years ago • 1 comments

Adds widget/contrib/nvidia.lua, for accessing NVIDIA GPU usage and temperature info.

Requires nvidia-smi to be installed. This is made clear in a comment and in the proposed wiki page for the widget.

Proposed wiki page: https://github.com/tronfy/lain/wiki/nvidia

tronfy avatar Jan 01 '23 21:01 tronfy

As this widget is quite simple, I'd suggest creating a watch recipe instead:

local nvidia = awful.widget.watch( -- dependency: nvidia-smi
    "nvidia-smi --query-gpu=utilization.gpu,temperature.gpu --format=csv,noheader,nounits",
    5, -- timeout in seconds
    function(widget, stdout)
        local usage, temp = stdout:match("([^,]+),([^,]+)")

        widget:set_text(string.format("%d%% %.1f", usage, temp)) -- customize here
end)

Please create a PR to awesome-www. See here for previous examples.

lcpz avatar Jan 03 '23 17:01 lcpz