You are not logged in.
So, I've been tinkering around with londonali1010's ring meters for conky. purdy. see here if you don't know the rings
Then, thinks I, it would be nice if my cpu monitor changed colour depending on the frequency scaling settings.
So. time to learn some Lua.
I have a variable which changes value for colour based on cpu frequency (my freq options are 1600, 1060 and 800)
fstr=tonumber(conky_parse('freq'))
print(fstr)
if fstr == 800 then
cpucolor=0xffff00
else
cpucolor=0xff0000
endand that's all fine. Yellow for 800Mhz, red for anything else. Eventually, I'll put in orange for 1060, but for now it'll do. I've put it in the correct place so it runs each time conky updates - previously ran once when the script loaded.
what I can't get it to do is change the value of fg_colour in Ali's settings_table table for each time conky_ring_stats runs.
{
name='cpu',
arg='cpu0',
max=100,
bg_colour=0xffffff,
bg_alpha=0.1,
fg_colour=cpucolor,
fg_alpha=0.8,
x=941, y=65,
radius=41,
thickness=11,
start_angle=0,
end_angle=180
}I've tried:
fg_colour=_G[cpucolor]no joy.
Any tips/guidance would be much appreciated. Lua seems nice.
Offline
As always when I've spent ages bashing away at something, I've solved it myself within no time of posting on a forum about it. 
fstr=tonumber(conky_parse('${freq}','')fstr)
if fstr == 800 then
settings_table[2]['fg_colour']=0xffff00
else
settings_table[2]['fg_colour']=0xff0000
endWas all it took. the cpu settings in settings_table are in the second position, what I (being a php/bash-ist) would address as settings_table[1]
it appears Lua counts from 1, not 0. Not what I was expecting, but there you go.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.