summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel von Maltitz <von.maltitz@gmx.de>2019-07-19 18:46:28 +0200
committerGitHub <noreply@github.com>2019-07-19 18:46:28 +0200
commit38508b06dc35760b48d1aafa1c1a6026f50002c5 (patch)
tree42ffeb5aa62870a23c03e9bef547f2de2e664266
parent372ae3c9e7cab4b64b8dcaf31d9d2d921a723585 (diff)
Make ram-widget compatible for non-english OS
The output of the free command is grep'ed while assuming english column names. This grep fails when given non-english localization. Setting the LANGUAGE variable inside the bash invocation solves this problem.
-rw-r--r--ram-widget/ram-widget.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua
index 3072068..a783b3c 100644
--- a/ram-widget/ram-widget.lua
+++ b/ram-widget/ram-widget.lua
@@ -42,7 +42,7 @@ local function getPercentage(value)
return math.floor(value / (total+total_swap) * 100 + 0.5) .. '%'
end
-watch('bash -c "free | grep -z Mem.*Swap.*"', 1,
+watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', 1,
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+)')