Memory usage in percentage

Is it possible to get used memory in percent?

I can't find that option anywhere, but I'm new to widget making, so maybe I'm just missing something obvious.

Yeah sure, you just need to do some math, so, total memory (in megabytes) is $rm(mtot)$ while used one is $rm(mused)$ so you can get

  • Used percentage by doing $mu(round, 100/rm(mtot)*rm(mused))$% the "mu(round, xx)" part ensures you get a whole number without decimals
  • Free percentage is then $mu(round, 100/rm(mtot)*rm(mfree))$%

If you are using this a lot in your preset you can define a text global with that formula and then just use the global instead

Thanks!

Not super obvious for someone who don't know anything about coding. But that makes alot of sense.

I didn't even think about including calculations outside of the presets/examples that are available in kustom. This opens up alot of other possibilities as well.