Adapt to awful.widget.graph max_value of 1
Vicious will now divide values by 100 to match the default graph max_value of 1. Graphs support changing this value, but progressbars don't. We shouldn't use 100 for one and 1 for the other.
This commit is contained in:
parent
25ce79e4e5
commit
40d7881977
1
README
1
README
|
@ -338,7 +338,6 @@ Battery widget
|
||||||
CPU usage widget
|
CPU usage widget
|
||||||
cpuwidget = awful.widget.graph()
|
cpuwidget = awful.widget.graph()
|
||||||
cpuwidget:set_width(50)
|
cpuwidget:set_width(50)
|
||||||
cpuwidget:set_max_value(100)
|
|
||||||
cpuwidget:set_background_color('#494B4F')
|
cpuwidget:set_background_color('#494B4F')
|
||||||
cpuwidget:set_color('#FF5656')
|
cpuwidget:set_color('#FF5656')
|
||||||
cpuwidget:set_gradient_colors({ '#FF5656', '#88A175', '#AECF96' })
|
cpuwidget:set_gradient_colors({ '#FF5656', '#88A175', '#AECF96' })
|
||||||
|
|
10
init.lua
10
init.lua
|
@ -62,13 +62,13 @@ widgets = {}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Widget types
|
-- {{{ Widget types
|
||||||
for w, i in pairs(_M) do
|
for i, w in pairs(_M) do
|
||||||
-- Ensure we don't call ourselves
|
-- Ensure we don't call ourselves
|
||||||
if i and i ~= _M and type(i) == "table" then
|
if w and w ~= _M and type(w) == "table" then
|
||||||
-- Ignore the function table and helpers
|
-- Ignore the function table and helpers
|
||||||
if w ~= "widgets" and w ~= "helpers" then
|
if i ~= "widgets" and i ~= "helpers" then
|
||||||
-- Place widgets in the namespace table
|
-- Place widgets in the namespace table
|
||||||
widgets[w] = i
|
widgets[i] = w
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -257,7 +257,7 @@ function update(widget, reg, disablecache)
|
||||||
end
|
end
|
||||||
|
|
||||||
if widget.add_value ~= nil then
|
if widget.add_value ~= nil then
|
||||||
widget:add_value(tonumber(data))
|
widget:add_value(tonumber(data) / 100)
|
||||||
elseif widget.set_value ~= nil then
|
elseif widget.set_value ~= nil then
|
||||||
widget:set_value(tonumber(data) / 100)
|
widget:set_value(tonumber(data) / 100)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue