diff options
Diffstat (limited to 'cpu-widget')
-rw-r--r-- | cpu-widget/README.md | 1 | ||||
-rw-r--r-- | cpu-widget/cpu-widget.lua | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/cpu-widget/README.md b/cpu-widget/README.md index 35e0eeb..8c4528c 100644 --- a/cpu-widget/README.md +++ b/cpu-widget/README.md @@ -28,6 +28,7 @@ It is possible to customize widget by providing a table with all or some of the | `color` | `beautiful.fg_normal` | Color of the graph | | `enable_kill_button` | `false` | Show button which kills the process | | `process_info_max_length` | `-1` | Truncate the process information. Some processes may have a very long list of parameters which won't fit in the screen, this options allows to truncate it to the given length. | +| `timeout` | 1 | How often in seconds the widget refreshes | ### Example diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua index 76f739f..8d5f497 100644 --- a/cpu-widget/cpu-widget.lua +++ b/cpu-widget/cpu-widget.lua @@ -96,6 +96,7 @@ local function worker(args) local color = args.color or beautiful.fg_normal local enable_kill_button = args.enable_kill_button or false local process_info_max_length = args.process_info_max_length or -1 + local timeout = args.timeout or 1 local cpugraph_widget = wibox.widget { max_value = 100, @@ -138,7 +139,7 @@ local function worker(args) local cpu_widget = wibox.container.margin(wibox.container.mirror(cpugraph_widget, { horizontal = true }), 0, 0, 0, 2) local cpus = {} - watch([[bash -c "cat /proc/stat | grep '^cpu.' ; ps -eo '%p|%c|%C|' -o "%mem" -o '|%a' --sort=-%cpu | head -11 | tail -n +2"]], 1, + watch([[bash -c "cat /proc/stat | grep '^cpu.' ; ps -eo '%p|%c|%C|' -o "%mem" -o '|%a' --sort=-%cpu | head -11 | tail -n +2"]], timeout, function(widget, stdout) local i = 1 local j = 1 |