Closed fmonteghetti closed 2 years ago
Thanks a lot, this is a very useful patch, I will update the extension and apply it.
Thanks a lot for your suggestion, I have updated the extension.
Filling 0 in front of usage value seems a bit strange, so I changed to filling spaces in front of usage value, but there are still issues that cause distraction when using variable-width fonts, because in variable-width fonts, spaces and numbers do not have the same width. So I added a setting for customize display font, when it is set to monospaced font, the problem was solved and the extension works fine. As this screenshot shows:
If you prefer to fill 0, you can modify the parameters of padStart()
in these two places:
https://github.com/LGiki/gnome-shell-extension-simple-system-monitor/blob/7bccbd05f472b1346d48aa39570121f548cb9003/src/extension.js#L254
https://github.com/LGiki/gnome-shell-extension-simple-system-monitor/blob/7bccbd05f472b1346d48aa39570121f548cb9003/src/extension.js#L259
Thanks a lot for this useful extension!
In the function extension.js::toDisplayString(), the string giving the CPU usage does not have a constant length. This means that when CPU usage crosses 10%, everything in the gnome shell top bar moves by 1 character, which can be distracting.
If you think this is worth fixing, I suggest the attached patch that introduces a function formatUsageVal() that relies on padStart() to provide a string with constant width. I have been using it without issue on 41.3.
patch.txt
The documentation for padStart() can be found here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart