NetMeter (A real-time network bandwidth monitor for Linux / GTK4)

Hello, I made this little tool inspired by a user demand @DavidA
You can find it there

:globe_with_meridians: NetMeter

A real-time network bandwidth monitor for Linux / GTK4,
inspired by the legendary NetMeter by Hootech.

Python GTK License Languages


:sparkles: Features

  • Scrolling graph β€” 120-second history
  • Two views, switchable with one click:
    • γ€° Lines β€” filled curves, oscilloscope style
    • β–Š Bars β€” DL/UL side-by-side bars with highlight
  • Auto-scaling Y axis β€” adapts to current peak, with dotted grid lines
  • Real-time speeds β€” KB/s (auto-upgrades to MB/s), Mbit/s or B/s
  • Session counters β€” total DL/UL since launch, resettable
  • Interface selector β€” all interfaces or one specific (right-click)
  • Always-on-top β€” stays visible above your other windows (survives mini mode toggle)
  • Resizable window with native WM decoration
  • Mini mode β€” compact windowless widget, draggable anywhere on screen:
    • Mini: text β€” speeds only (~2Γ—1 cm)
    • Mini: graph β€” full-width graph without axis, lines or bars
  • 3 languages β€” English :united_kingdom: / FranΓ§ais :france: / Deutsch :germany: (auto-detected, switchable)

:package: Dependencies

Required

Package Role Install
python3 β‰₯ 3.10 Interpreter already there :grinning_face_with_smiling_eyes:
python3-gi GObject/GTK4 bindings sudo apt install python3-gi
python3-gi-cairo Cairo rendering sudo apt install python3-gi-cairo
gir1.2-gtk-4.0 GTK 4 library sudo apt install gir1.2-gtk-4.0
python3-psutil Network counter reading sudo apt install python3-psutil

Recommended

Package Role Install
wmctrl Reliable always-on-top (EWMH) sudo apt install wmctrl
x11-utils Fallback always-on-top (xprop) sudo apt install x11-utils

Note: wmctrl is strongly recommended. Without it, the xprop fallback is attempted but may not work depending on your window manager.

One-liner

sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0 python3-psutil wmctrl


:rocket: Installation

Quick method (provided script)

chmod +x install.sh ./install.sh

The script installs missing dependencies, copies netmeter.py to ~/.local/bin/, and creates a .desktop launcher in ~/.local/share/applications/.

Manual method

cp netmeter.py ~/.local/bin/netmeter chmod +x ~/.local/bin/netmeter netmeter


:computer_mouse: Usage

Action Effect
β–Š Bars / γ€° Lines button Switch between graph views
Right-click on the window Open context menu
Menu β†’ Interface Select a network interface
Menu β†’ Unit B/s, KB/s (auto MB/s) or Mbit/s
Menu β†’ Language Switch UI language (EN / FR / DE)
Menu β†’ Reset session Reset DL/UL session counters
Menu β†’ Mini mode Enter compact windowless mode
Menu β†’ Mini: graph / Mini: text Switch mini sub-mode (in mini mode only)
Menu β†’ Normal mode Return to full window (in mini mode)
Left-click drag Move window (mini mode, no decoration)
Menu β†’ Quit Exit the application

:wrench: Quick configuration

Constants at the top of the file:

HISTORY = 120 # Graph history duration (seconds)
TICK_MS = 1000 # Refresh interval (ms)
WIN_W, WIN_H = 690, 345 # Default window size (px)
MINI_W = 260 # Mini mode width (px)
MINI_H_GRAPH = 72 # Mini graph height (px)
LM = 110 # Left margin for Y labels (px)

Colours (R, G, B between 0 and 1):

C_DL = (0.25, 0.73, 0.31) # Green β€” Download C_UL = (0.97, 0.50, 0.40) # Red β€” Upload


:penguin: Compatibility

Environment Status
Zorin OS 17/18 (GNOME, X11) :white_check_mark: Tested
Ubuntu 22.04 / 24.04 (GNOME, X11) :white_check_mark: Compatible
Wayland :warning: Not tested β€” drag and always-on-top may differ
GTK < 4.0 :cross_mark: Not supported
4 Likes

Hello Nourpon, I tested the NetMeter in a Zorin 18.1 live session and it worked. During the installation with the script I got this message. I'm not sure if it was because of the live session. I added the line to the ~/.profile's file manually.
Adding the NetMeter to autostart also worked.

A smaller unit as KB/s is not possible, or?

The manual method didn't work for me in the live session (I created the not existing folders and put the python file there and made it executable).
I was not able to launch the program.
Edit: Ah, when I enter the path of that file in the terminal, then netmeter works and is opened. With netmeter it doesn't work.

1 Like

the message is about live session, what unit you want, because you can change it to Mbits/s with right click on the graph

I added B/s as unit

2 Likes

Thank you very much!

1 Like

Okay, a new Invention. I tried it, too. Unfortunately, I wasn't able to make it run the manually Method. I created the bin Folder, I moved the netmeter.py File into it and made it executable. But ... nothing happens when I want use it. I typed in Terminal netmeter but there was only the Roor that the Command wasn't found. I created a .desktop File and that was in the Startmenu. But when I clicked on it nothing happens.

Then I deleted everything and used Your install.sh Script and it worked fine. Interestingly, I had the same Warning as @Forpli:

But it didn't seem to affect the Function. I can start it and it runs. the only Thing is: It start in a relatively small Window and the Fonts Size of the Values is small, too. But I guess this is because my System runs in Wayland.

(It might on the Picture bigger than it actually is)

One Thing to make a bit better: The Values at the Side and under the red and green one, You could make a bit lighter to be more visible.

For me the manual method worked when I created a desktop file with main menu and set the path to the python file as command.
(~/.local/bin/netmeter/netmeter.py)
Then it was launched via start menu.

I need to improve many things, I will but for now I need a break from my computer :wink:

2 Likes

OK I made lighter fonts at the side and under the green and red one, I also improved font size and window size at startup.
I pushed the corrected script on my Github

3 Likes

and a couple of Minutes later:

That doesn't sound like You have made a Break, hahaha!

1 Like

Gee, if you wizards had trouble installing it, what chance have I got? But I'm going to give it a go... :slight_smile: I just haven't had time today.

When You use the install.sh Script, it should work fine. So, don't be too concerned. And if You need help, You can ask of Course.

2 Likes

Just for my better tester I made some efforts :wink:

1 Like

Nourpon, as requested, adding an enhancement suggestion. And thank you yet again for such an excellent and useful app.
Suggestion The window is resizable down to a certain depth, and is still minimum 2cm deep. Is it possible to lose the title and make it vertically resizable to, say, 1cm? That would allow me to see the Firefox bookmark bar. Thank you.

big update, you can toggle now to mini mode with right click
text
image
or graph
image

just download the netmeter.py and replace it in $HOME/.local/bin/
you can change the height of the graph by editing the file and change the value here
MINI_H_GRAPH = 50 # mini graphe

2 Likes

This is a really nice enhancement - the mini-text view is great.
I have tried tweaking the various figures, but I can't resize the height of the main window (graph & text), and (more importantly) the display in all formats disappears when I select any new window - the "stay on top" function doesn't work (for me), and I thought it did on the original version?
Thanks again for creating this really useful app.

for the always on top you need to activate it on the normal mode (right click on windows bar and select the option) and switch to mini mode, it will stay always on top
you can't resize the mini with mouse, it's a gtk limitation, you can do it in the file only as I said
Constants at the top of the file:

HISTORY = 120 # Graph history duration (seconds)
TICK_MS = 1000 # Refresh interval (ms)
WIN_W, WIN_H = 690, 345 # Default window size (px)
MINI_W = 260 # Mini mode width (px)
MINI_H_GRAPH = 72 # Mini graph height (px)
LM = 110 # Left margin for Y labels (px)

2 Likes

Ha... :slight_smile: My bad - stupidity rules... Thank you.
I'll play with the figures, but if I can't make the main window the size that I'd like I'm very happy with the mini-text display. It's a really useful tool.

1 Like

A little Update: I used Your new Version. Now with using the install.sh File, I didn't got the Error that I had before:

The Program itself runs fine. The Changes in Font Size and Color helped with the Visibility significantly. Maybe, You could make some slightliy Font size Adjustments to these Area's:

To be precise with Position 2: I don't mean making the Button bigger. The Size is okay. I mean the Font Size in the Button.

And there came another Idea to my Mind: You offer for Install the install.sh File. Maybe create an uninstall.sh File for uninstall it. I mean, to remove it manually isn't difficult but to have that with the Script would be a bit more holistic (<= nice Word, hahaha!).

2 Likes

I will se for the uninstall it's a good idea.
for the font size I will not change it, but if you want you can try to change the size in this key directly in the file and test

cr.set_font_size

and this keys in "pseudo" CSS

font-size

play with this values and test :wink:

1 Like