You are not logged in.

#1 2012-03-03 11:02:22

Kodama
Member
Registered: 2009-11-02
Posts: 53

awesome wm - issues with vicious widgets

in my quest for my perfect awesome-wm desktop I came across some issues with widgets.

What I'm trying to do is have a vicious widget to show GPU Temperatur. I can get the info of my AMD HD6950 like this;

aticonfig --odgt

which gives me:

Default Adapter - AMD Radeon HD 6900 Series 
Sensor 0: Temperature - 37.00 C

so doing:

aticonfig --odgt | grep Temperature | awk '{print $5}'

gives me the value I need:

37.50

then I took a gpu.lua for an nvidia card and changed it to fit my AMD needs:

  GNU nano 2.2.6                              Datei: .config/awesome/vicious/widgets/gpu.lua                                                                   

-- {{{ Grab environment
local tonumber = tonumber
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { match = string.match }
local helpers = require("vicious.helpers")
-- }}}
 
-- Gpu: provide gpu temperature for nvidia cards
module("vicious.widgets.gpu")
 
-- {{{ Gpu widget type
function worker(format)
    -- Get temperature from nvidia-smi
    local gT = io.popen('aticonfig --odgt | grep Temperature | awk \'{ print $5 }\'')
    --local gT = io.popen('echo 0')
    --local gT = io.popen('nvidia-settings -q [gpu:0]/GPUCoreTemp | grep "Attribute" | sed -e "s/.*: //g" -e "s/\.//g"')
    local gpuTemp = gT:read()
    gT:close()
   
    if (gpuTemp == nil) then
        return ''
    end
   
    return gpuTemp
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

or as an alternative:

local os = {getenv = os.getenv}
-- }}}


-- Thermalati: provides temperature for ati gfx cards
module("vicious.widgets.thermalati")


-- {{{ Read temperature from aticonfig utility
local function get_gpu_temp()
    local gpu_temp = nil
    if os.getenv('DISPLAY') then
        local f = io.popen('aticonfig --odgt | grep Temperature | awk \'{ print $5 }\'')
        gpu_temp = f:read("*all")
        f:close()
    end
    return gpu_temp
end
-- }}}

-- {{{ Thermal widget type
local function worker(format)

    -- Get temperature from thermal zone
    local res = get_gpu_temp()
    if res then
        return {tonumber(res)}
    end

    return {0}
end
-- }}}

setmetatable(_M, { __call = function(_, ...) return worker(...) end })

then in the rc.lua I would do something like:

-- GPUwidget
gpuwidget = widget({ type = "textbox" })
vicious.register(gpuwidget, vicious.widgets.thermalati, '<span color="#93e0e3">GPU $1°C</span>', 31)

and register it with:

    -- Create the wibox
gpuwidget

but this doesn't work and sets awesome back to default.
Can someone be so kind es to give me the correct gpu.lua code and how to register it correctly?

------------------------------------------------------------------------

the second widget is about HDD temperature. I've taken the one from the vicious folder from git:

---------------------------------------------------
-- Licensed under the GNU General Public License v2
--  * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------

-- {{{ Grab environment
local tonumber = tonumber
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { gmatch = string.gmatch }
-- }}}


-- Hddtemp: provides hard drive temperatures using the hddtemp daemon
module("vicious.widgets.hddtemp")


-- {{{ HDD Temperature widget type
local function worker(format, warg)
    -- Fallback to default hddtemp port
    if warg == nil then warg = 7634 end

    local hdd_temp = {} -- Get info from the hddtemp daemon
    local f = io.popen("echo | curl --connect-timeout 1 -fsm 3 telnet://127.0.0.1:"..warg)

    for line in f:lines() do
        for d, t in string.gmatch(line, "|([%/%a%d]+)|.-|([%d]+)|[CF]+|") do
            hdd_temp["{"..d.."}"] = tonumber(t)
        end
    end
    f:close()

    return hdd_temp
end
-- }}}

setmetatable(_M, { __call = function(_, ...) return worker(...) end })

and registered it:

-- HDDwidget
hddtempwidget = widget({ type = "textbox" })
vicious.register(hddtempwidget, vicious.widgets.hddtemp, '<span color="#93e0e3">HDD ${/dev/sda}°C</span>', 19)

but that won't show the temperature in the taskbar but just:

HDD ${/dev/sda}°C

as you can see in this screenshot: http://www-public.rz.uni-duesseldorf.de … _scrot.png

hope you guys can help me out on this one
thanks in advance
Andreas

Last edited by Kodama (2012-03-03 11:05:02)

Offline

#2 2012-03-10 07:06:30

Kodama
Member
Registered: 2009-11-02
Posts: 53

Re: awesome wm - issues with vicious widgets

ok, at least the HDD Temperature issue is fixed. I just had to install hddtemp and put it in the DAEMONS section of my /etc/rc.conf file.

hopefully someone can help me with the gpu.lua issue.

Offline

Board footer

Powered by FluxBB