Skip to content

internet-speed-meter@mebs: Add new applet - #8915

Open
MDHasan0078 wants to merge 2 commits into
linuxmint:masterfrom
MDHasan0078:add-internet-speed-meter
Open

internet-speed-meter@mebs: Add new applet#8915
MDHasan0078 wants to merge 2 commits into
linuxmint:masterfrom
MDHasan0078:add-internet-speed-meter

Conversation

@MDHasan0078

Copy link
Copy Markdown

A lightweight Cinnamon applet that displays real-time internet upload and download speed in the panel.

Features

  • Real-time download/upload speed (auto-scaling units: B/s, KB/s, MB/s, GB/s or bit variants)
  • Automatic interface detection via the default route (no external commands spawned)
  • Compact single-line or stacked layout
  • Configurable refresh interval, decimal places, and font size

Implementation notes

  • Reads rx_bytes/tx_bytes from /sys/class/net/<iface>/statistics/
  • Uses only Mainloop.timeout_add + file reads per tick (no subprocesses, no watchdog warnings)
  • GPL-3.0

Screenshot

@github-actions

Copy link
Copy Markdown
Contributor

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Most findings
are advisory and do not automatically disqualify a pull request.

This check is not perfect and will not replace a normal review.


Found 2 potential issue(s):

⚠️ WARNING

⚠️ sync_file_get_contents

internet-speed-meter@mebs/files/internet-speed-meter@mebs/applet.js:43

let [, content] = GLib.file_get_contents("/proc/net/route");

Synchronous file_get_contents() blocks the main loop.
Use Gio.File.load_contents_async() instead.

internet-speed-meter@mebs/files/internet-speed-meter@mebs/applet.js:60

let [, content] = GLib.file_get_contents(path);

Synchronous file_get_contents() blocks the main loop.
Use Gio.File.load_contents_async() instead.


Automated pattern check.

@MDHasan0078

Copy link
Copy Markdown
Author

Fixed the two best-practices scanner findings. Replaced both synchronous GLib.file_get_contents() calls with async Gio.File.load_contents_async():

  • Interface detection now reads /proc/net/route asynchronously (with a _detecting guard so retries don't stack).
  • Speed sampling now chains async reads per tick (rx_bytes \u2192 tx_bytes \u2192 compute) with a _sampling guard to prevent overlapping samples.

Verified live after reload: label updates correctly (\u2193 49.0 KB/s \u2191 6.3 KB/s \u2192 \u2193 2.4 KB/s \u2191 2.4 KB/s), no new warnings in ~/.xsession-errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant