tmux-plugins / tmux-cpu

Plug and play cpu percentage and icon indicator for Tmux.
MIT License
444 stars 69 forks source link

Fix ram_percentage.sh script when running on non-US locales #46

Closed vinipsmaker closed 4 years ago

vinipsmaker commented 4 years ago

are there any other scripts which need this?

I only use the CPU and RAM script. Only RAM needed.

Also without adding this, what's the output of free/vm_stat on your machine?

$ free
              total       usada       livre    compart.  buff/cache  disponível
Mem.:       7607696     4095064      542848      729176     2969784     2481620
Swap:      16777212      154320    16622892
$ vm_stat
zsh: command not found: vm_stat
zsh: exit 127   vm_stat
casperdcl commented 4 years ago

interesting. Can you post the output of this (should be the same regardless of whether you export LANG=C)?

free | awk -v format="%3.1f%%\n" '$1 ~ /Mem/ {printf(format, 100*$3/$2)}'
vinipsmaker commented 4 years ago

The new command works regardless of my LANG env. However I don't think it's safe. Memory is translated as memória in my language. The translated string is probably just the first letters because it didn't fit in space. I bet it'd fail on other languages.

casperdcl commented 4 years ago

the only difference was Mem: versus Mem.: which seems more silly than a language change - it implies in future even LANG=C may break if it changes to add the extra dot.