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.
This commit is contained in:
parent
b41daeb9b2
commit
2752c06548
|
@ -48,7 +48,7 @@ local function worker(args)
|
||||||
return math.floor(value / (total+total_swap) * 100 + 0.5) .. '%'
|
return math.floor(value / (total+total_swap) * 100 + 0.5) .. '%'
|
||||||
end
|
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)
|
function(widget, stdout, stderr, exitreason, exitcode)
|
||||||
total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
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+)')
|
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
||||||
|
|
Loading…
Reference in New Issue