Use logarithmic scale for speed bar gauge

The linear scale against WiFi 7 theoretical max (5760 Mbit/s) made real-world speeds look insignificantly low. A logarithmic scale gives meaningful visual feedback for typical connections (e.g. 300 Mbit/s fills ~66% instead of ~5%).

Bump version to 6.
This commit is contained in:
Jalil Arfaoui 2026-03-16 10:54:18 +01:00
parent 896e513a17
commit 244d69919d
2 changed files with 5 additions and 3 deletions

View file

@ -3,7 +3,7 @@
"name": "WiFi Signal Plus",
"description": "Displays WiFi generation (4/5/6/7) in the top bar with detailed connection info on hover",
"shell-version": ["45", "46", "47", "48", "49"],
"version": 5,
"version": 6,
"url": "https://github.com/JalilArfaoui/gnome-extension-wifi-signal-plus",
"donations": {
"liberapay": "Jalil"

View file

@ -41,7 +41,8 @@ import {
const REFRESH_INTERVAL_SECONDS = 5;
const BACKGROUND_SCAN_INTERVAL_SECONDS = 300;
const PLACEHOLDER = '--' as const;
// WiFi 7 theoretical max: 320 MHz, MCS 13 (4096-QAM 5/6), 4×4 MIMO, GI 0.8µs
// WiFi 7 theoretical max: 320 MHz, MCS 13 (4096-QAM 5/6), 4×4 MIMO, GI 0.8µs.
// Speed bar uses logarithmic scale so real-world values fill the gauge meaningfully.
const MAX_SPEED_MBPS = 5760;
const MAX_CHANNEL_WIDTH_MHZ = 320;
const MIN_SIGNAL_DBM = -90;
@ -588,7 +589,8 @@ export default class WifiSignalPlusExtension extends Extension {
private getSpeedPercent(info: ConnectedInfo): number {
const speed = Math.max(info.txBitrate ?? 0, info.rxBitrate ?? 0, info.bitrate);
return Math.min(100, (speed / MAX_SPEED_MBPS) * 100);
if (speed <= 0) return 0;
return Math.min(100, (Math.log(1 + speed) / Math.log(1 + MAX_SPEED_MBPS)) * 100);
}
private getWidthPercent(width: ChannelWidthMHz | null): number {