From 2752c06548c419ba657adb67e7a94a1dc5d5d1fa Mon Sep 17 00:00:00 2001 From: Marcel von Maltitz Date: Fri, 19 Jul 2019 18:46:28 +0200 Subject: 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. --- ram-widget/ram-widget.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ram-widget/ram-widget.lua') diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua index a5414c8..d8cb11f 100644 --- a/ram-widget/ram-widget.lua +++ b/ram-widget/ram-widget.lua @@ -48,7 +48,7 @@ local function worker(args) 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+)') -- cgit v1.2.3