ram-widget: support custom colors
This commit is contained in:
parent
fc0293047b
commit
42dd36c604
|
@ -11,13 +11,18 @@ local ramgraph_widget = {}
|
||||||
local function worker(user_args)
|
local function worker(user_args)
|
||||||
local args = user_args or {}
|
local args = user_args or {}
|
||||||
local timeout = args.timeout or 1
|
local timeout = args.timeout or 1
|
||||||
|
local color_used = args.color_used or beautiful.bg_urgent
|
||||||
|
local color_free = args.color_free or beautiful.fg_normal
|
||||||
|
local color_buf = args.color_buf or beautiful.border_color_active
|
||||||
|
local widget_show_buf = args.widget_show_buf or false
|
||||||
|
|
||||||
--- Main ram widget shown on wibar
|
--- Main ram widget shown on wibar
|
||||||
ramgraph_widget = wibox.widget {
|
ramgraph_widget = wibox.widget {
|
||||||
border_width = 0,
|
border_width = 0,
|
||||||
colors = {
|
colors = {
|
||||||
beautiful.bg_urgent, -- used
|
color_used,
|
||||||
beautiful.fg_normal -- free
|
color_free,
|
||||||
|
color_buf,
|
||||||
},
|
},
|
||||||
display_labels = false,
|
display_labels = false,
|
||||||
forced_width = 25,
|
forced_width = 25,
|
||||||
|
@ -33,9 +38,9 @@ local function worker(user_args)
|
||||||
forced_height = 200,
|
forced_height = 200,
|
||||||
forced_width = 400,
|
forced_width = 400,
|
||||||
colors = {
|
colors = {
|
||||||
beautiful.bg_urgent, -- used
|
color_used,
|
||||||
beautiful.fg_normal, -- free
|
color_free,
|
||||||
beautiful.border_color_active, -- buf_cache
|
color_buf, -- buf_cache
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
shape = gears.shape.rounded_rect,
|
shape = gears.shape.rounded_rect,
|
||||||
|
@ -56,7 +61,11 @@ local function worker(user_args)
|
||||||
total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
||||||
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
||||||
|
|
||||||
|
if widget_show_buf then
|
||||||
|
widget.data = { used, free, buff_cache }
|
||||||
|
else
|
||||||
widget.data = { used, total-used }
|
widget.data = { used, total-used }
|
||||||
|
end
|
||||||
|
|
||||||
if popup.visible then
|
if popup.visible then
|
||||||
popup:get_widget().data_list = {
|
popup:get_widget().data_list = {
|
||||||
|
|
Loading…
Reference in New Issue