diff options
-rw-r--r-- | ram-widget/README.md | 12 | ||||
-rw-r--r-- | ram-widget/ram-widget.lua | 21 | ||||
-rw-r--r-- | volume-widget/volume.lua | 2 |
3 files changed, 28 insertions, 7 deletions
diff --git a/ram-widget/README.md b/ram-widget/README.md index 461aa99..8f8eee4 100644 --- a/ram-widget/README.md +++ b/ram-widget/README.md @@ -4,6 +4,18 @@ This widget shows the RAM usage. When clicked another widget appears with more d ![screenshot](./out.gif) +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `color_used` | `beautiful.bg_urgent` | Color for used RAM | +| `color_free` | `beautiful.fg_normal` | Color for free RAM | +| `color_buf` | `beautiful.border_color_active` | Color for buffers/cache | +| `widget_show_buf` | `false` | Whether to display buffers/cache separately in the tray widget. If `false`, buffers/cache are considered free RAM. | +| `timeout` | 1 | How often (in seconds) the widget refreshes | + ## Installation Please refer to the [installation](https://github.com/streetturtle/awesome-wm-widgets#installation) section of the repo.
\ No newline at end of file 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 = { diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 59f0a7a..6e99f27 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -167,7 +167,7 @@ local function worker(user_args) local refresh_rate = args.refresh_rate or 1 if widget_types[widget_type] == nil then - volume.widget = widget_types['icon_and_text'].get_widget(user_args.icon_and_text_args) + volume.widget = widget_types['icon_and_text'].get_widget(args.icon_and_text_args) else volume.widget = widget_types[widget_type].get_widget(args) end |