You can use Python to create a gnome extension that shows memory use. (Gnome is quite a memory eater).
See that little memory icon with the percentage use? That's what we'll build.
If you have the memory problem with gnome, the lazy fix for this is not to tweak gnome, but to add a more ram memory.
To create gnome extensions in Python, you can use argos. An extension that lets you use Python to create your extension
So first install the argos extension and enable it in gnome-tweak-tool. This extension is in the default ubuntu repo.
The extension can be refreshed, by setting the filename
ram.3s+.py
would referesh every 3 seconds.
ram.6s+.py
would refresh every 6 seconds.
Enter the matrix
Now we type a few lines of Python. The module psutil can give you the current memory use.
#!/usr/bin/python
import os
import psutil
print( str(psutil.virtual_memory()[2]) + "% | iconName=gnome-dev- memory")
print("---")
print("Use: " + str(psutil.virtual_memory()[2]) + "%")
print("---")
Save it in ~/.config/argos
Make sure to
chmod +x your_script.py
Then it will show the memory right in your top bar! :D
Resources:
Top comments (0)