summaryrefslogtreecommitdiff
path: root/cpu-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-09-21 20:53:22 -0400
committerGitHub <noreply@github.com>2020-09-21 20:53:22 -0400
commit31213af0082bef8344475dbeb84205f1a7e31c7d (patch)
tree2a8b4cad8363c5a0019466edf86d8ef99941d2f4 /cpu-widget
parenta127ffe8efc8ccb91b7a8495c23f67278609df25 (diff)
parent21150bd640f086f617c61b32cde5e45ecfb5158f (diff)
Merge pull request #188 from brucec5/widget-tweaks
Add customizable refresh timeouts to most widgets
Diffstat (limited to 'cpu-widget')
-rw-r--r--cpu-widget/README.md1
-rw-r--r--cpu-widget/cpu-widget.lua3
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