summaryrefslogtreecommitdiff
path: root/ram-widget
diff options
context:
space:
mode:
authorChris Bruce <aprofessionalemailaddress@gmail.com>2020-09-19 01:08:15 -0700
committerChris Bruce <aprofessionalemailaddress@gmail.com>2020-09-19 01:08:15 -0700
commita2eddcdfcd87976866f797b5ad2b795495d2e620 (patch)
treee3498520985e33915a211389951d6c0c971b972b /ram-widget
parenta127ffe8efc8ccb91b7a8495c23f67278609df25 (diff)
Add widget timeouts
Diffstat (limited to 'ram-widget')
-rw-r--r--ram-widget/ram-widget.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua
index d8cb11f..55b6fd7 100644
--- a/ram-widget/ram-widget.lua
+++ b/ram-widget/ram-widget.lua
@@ -7,6 +7,7 @@ local ramgraph_widget = {}
local function worker(args)
local args = args or {}
+ local timeout = args.timeout or 1
--- Main ram widget shown on wibar
ramgraph_widget = wibox.widget {
@@ -48,7 +49,7 @@ local function worker(args)
return math.floor(value / (total+total_swap) * 100 + 0.5) .. '%'
end
- watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', 1,
+ watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', timeout,
function(widget, stdout, stderr, exitreason, exitcode)
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+)')