summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-04-11 19:30:30 +0100
committerNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-04-11 19:40:42 +0100
commit42dd36c6040f8ca7a6103a653c02224a7df85647 (patch)
treefc9a649c5344714d6714e0c3e1fcd66773d654f1
parentfc0293047ba898a546901d53e6cc1ca5c02d8787 (diff)
ram-widget: support custom colors
-rw-r--r--ram-widget/ram-widget.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua
index 49a7d3b..1b5cdcf 100644
--- a/ram-widget/ram-widget.lua
+++ b/ram-widget/ram-widget.lua
@@ -11,13 +11,18 @@ local ramgraph_widget = {}
local function worker(user_args)
local args = user_args or {}
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
ramgraph_widget = wibox.widget {
border_width = 0,
colors = {
- beautiful.bg_urgent, -- used
- beautiful.fg_normal -- free
+ color_used,
+ color_free,
+ color_buf,
},
display_labels = false,
forced_width = 25,
@@ -33,9 +38,9 @@ local function worker(user_args)
forced_height = 200,
forced_width = 400,
colors = {
- beautiful.bg_urgent, -- used
- beautiful.fg_normal, -- free
- beautiful.border_color_active, -- buf_cache
+ color_used,
+ color_free,
+ color_buf, -- buf_cache
},
},
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 =
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
- widget.data = { used, total-used }
+ if widget_show_buf then
+ widget.data = { used, free, buff_cache }
+ else
+ widget.data = { used, total-used }
+ end
if popup.visible then
popup:get_widget().data_list = {