From 5d6053eccc70536fc44382766abbf2a8c01e5b44 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 08:52:36 +0530 Subject: [PATCH 01/10] Add use-bits option for network bandwidth Option to display network speeds in bits-per-second instead of bytes. --- data/io.elementary.monitor.gschema.xml | 5 +++++ src/Indicator/Services/DBusClient.vala | 1 + src/Indicator/Widgets/DisplayWidget.vala | 7 +++++++ .../Widgets/IndicatorWidgetBandwidth.vala | 4 +++- src/Services/DBusServer.vala | 1 + src/Utils.vala | 15 +++++++++++++++ src/Views/PreferencesView.vala | 7 +++++++ src/Views/SystemView/SystemNetworkView.vala | 6 ++++-- src/Views/SystemView/SystemView.vala | 7 +++++++ src/meson.build | 1 + 10 files changed, 51 insertions(+), 3 deletions(-) diff --git a/data/io.elementary.monitor.gschema.xml b/data/io.elementary.monitor.gschema.xml index 8a174d2e0..7a269bf32 100644 --- a/data/io.elementary.monitor.gschema.xml +++ b/data/io.elementary.monitor.gschema.xml @@ -60,6 +60,11 @@ To show network down bandwidth in Monitor Indicator or not To show network down bandwidth in Monitor Indicator or not + + false + To show network bandwidth in in bits instead of bytes per second + To show network bandwidth in in bits instead of bytes per second + false To show GPU used percentage in Monitor Indicator or not diff --git a/src/Indicator/Services/DBusClient.vala b/src/Indicator/Services/DBusClient.vala index 5b20140f9..50ab4424c 100644 --- a/src/Indicator/Services/DBusClient.vala +++ b/src/Indicator/Services/DBusClient.vala @@ -15,6 +15,7 @@ public interface Monitor.DBusClientInterface : Object { public signal void indicator_memory_state (bool state); public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); + public signal void network_use_bits_state (bool state); public signal void indicator_gpu_state (bool state); public signal void indicator_gpu_memory_state (bool state); public signal void indicator_gpu_temperature_state (bool state); diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala index 01fca412c..c104a645e 100644 --- a/src/Indicator/Widgets/DisplayWidget.vala +++ b/src/Indicator/Widgets/DisplayWidget.vala @@ -29,6 +29,9 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Box { memory_widget.visible = Indicator.settings.get_boolean ("indicator-memory-state"); network_up_widget.visible = Indicator.settings.get_boolean ("indicator-network-upload-state"); network_down_widget.visible = Indicator.settings.get_boolean ("indicator-network-download-state"); + bool use_bits = Indicator.settings.get_boolean ("network-use-bits-state"); + network_up_widget.use_bits = use_bits; + network_down_widget.use_bits = use_bits; gpu_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-state"); gpu_memory_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-memory-state"); gpu_temperature_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-temperature-state"); @@ -40,6 +43,10 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Box { dbusclient.interface.indicator_memory_state.connect ((state) => memory_widget.visible = state); dbusclient.interface.indicator_network_up_state.connect ((state) => network_up_widget.visible = state); dbusclient.interface.indicator_network_down_state.connect ((state) => network_down_widget.visible = state); + dbusclient.interface.network_use_bits_state.connect ((state) => { + network_up_widget.use_bits = state; + network_down_widget.use_bits = state; + }); dbusclient.interface.indicator_gpu_state.connect ((state) => gpu_widget.visible = state); dbusclient.interface.indicator_gpu_memory_state.connect ((state) => gpu_memory_widget.visible = state); dbusclient.interface.indicator_gpu_temperature_state.connect ((state) => gpu_temperature_widget.visible = state); diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index e58b3a2fe..f0b3a64e9 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -4,6 +4,8 @@ */ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { + public bool use_bits = false; + public IndicatorWidgetBandwidth (string icon_name) { base (icon_name); } @@ -11,6 +13,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = format_size (bandwidth); + label.label = Utils.Strings.format_network_speed (bandwidth, use_bits); } } diff --git a/src/Services/DBusServer.vala b/src/Services/DBusServer.vala index ddad83862..824133f43 100644 --- a/src/Services/DBusServer.vala +++ b/src/Services/DBusServer.vala @@ -22,6 +22,7 @@ public class Monitor.DBusServer : Object { public signal void indicator_memory_state (bool state); public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); + public signal void network_use_bits_state (bool state); public signal void indicator_gpu_state (bool state); public signal void indicator_gpu_memory_state (bool state); public signal void indicator_gpu_temperature_state (bool state); diff --git a/src/Utils.vala b/src/Utils.vala index 6a8cfe1d0..a301467a2 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -49,6 +49,21 @@ public class Monitor.Utils.Strings { return pretty; } + public static string format_network_speed (uint64 bandwidth, bool use_bits = false) { + const int SCALE = 1000; + bandwidth = bandwidth * (use_bits ? 8 : 1); + string unit_suffix = use_bits ? "bps" : "Bps"; + string[] units = { "", "K", "M", "G", "T" }; + + int unit_index = 0; + + while (bandwidth >= SCALE && unit_index < units.length - 1) { + bandwidth /= SCALE; + unit_index++; + } + + return "%llu %s%s".printf (bandwidth, units[unit_index], unit_suffix); + } } public class Monitor.Utils.Colors : Object { diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index fcb82da1f..23e2cc516 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -89,6 +89,11 @@ public class Monitor.PreferencesView : Granite.Bin { dbusserver.indicator_network_down_state (network_download_check.active); }); + var network_use_bits_check = new Gtk.CheckButton.with_label (_("Network use bits")); + network_use_bits_check.toggled.connect (() => { + dbusserver.network_use_bits_state (network_use_bits_check.active); + }); + var gpu_check = new Gtk.CheckButton.with_label (_("GPU percentage")); gpu_check.toggled.connect (() => { dbusserver.indicator_gpu_state (gpu_check.active); @@ -124,6 +129,7 @@ public class Monitor.PreferencesView : Granite.Bin { indicator_options_box.append (new Gtk.Separator (HORIZONTAL)); indicator_options_box.append (network_upload_check); indicator_options_box.append (network_download_check); + indicator_options_box.append (network_use_bits_check); var indicator_options_revealer = new Gtk.Revealer () { child = indicator_options_box @@ -158,5 +164,6 @@ public class Monitor.PreferencesView : Granite.Bin { settings.bind ("indicator-gpu-state", gpu_check, "active", DEFAULT); settings.bind ("indicator-network-download-state", network_download_check, "active", DEFAULT); settings.bind ("indicator-network-upload-state", network_upload_check, "active", DEFAULT); + settings.bind ("network-use-bits-state", network_use_bits_check, "active", DEFAULT); } } diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 1a4c5ef6e..7e405849f 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -11,6 +11,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { private LabelRoundy network_upload_label; private LabelRoundy network_download_label; + public bool use_bits = false; + construct { margin_top = 12; margin_bottom = 12; @@ -60,8 +62,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = ("%s/s").printf (format_size ((uint64) down_bytes, IEC_UNITS)); - network_upload_label.text = ("%s/s").printf (format_size ((uint64) up_bytes, IEC_UNITS)); + network_download_label.text = Utils.Strings.format_network_speed ((uint64) down_bytes, use_bits); + network_upload_label.text = Utils.Strings.format_network_speed ((uint64) up_bytes, use_bits); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index 43906b3c1..0cedb2811 100644 --- a/src/Views/SystemView/SystemView.vala +++ b/src/Views/SystemView/SystemView.vala @@ -50,6 +50,13 @@ public class Monitor.SystemView : Gtk.Box { } append (scrolled_window); + + unowned var dbusclient = DBusClient.get_default (); + dbusclient.interface.network_use_bits_state.connect ((state) => { + network_view.use_bits = state; + }); + Settings settings = new Settings ("io.elementary.monitor.settings"); + network_view.use_bits = settings.get_boolean ("network-use-bits-state"); } public void update () { diff --git a/src/meson.build b/src/meson.build index 036d04339..b3dcc7120 100644 --- a/src/meson.build +++ b/src/meson.build @@ -48,6 +48,7 @@ source_app_files = [ # Services 'Services/DBusServer.vala', 'Services/Appearance.vala', + 'Indicator/Services/DBusClient.vala', # Resources 'Resources/Resources.vala', From d535f395ee96e4b20b9007f6fe63b67cf8e341c7 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 08:37:24 +0530 Subject: [PATCH 02/10] Remove use-bits user prefs option, always use-bits --- data/io.elementary.monitor.gschema.xml | 5 ----- src/Indicator/Services/DBusClient.vala | 1 - src/Indicator/Widgets/DisplayWidget.vala | 7 ------- src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 4 +--- src/Services/DBusServer.vala | 1 - src/Views/PreferencesView.vala | 7 ------- src/Views/SystemView/SystemNetworkView.vala | 6 ++---- src/Views/SystemView/SystemView.vala | 7 ------- src/meson.build | 1 - 9 files changed, 3 insertions(+), 36 deletions(-) diff --git a/data/io.elementary.monitor.gschema.xml b/data/io.elementary.monitor.gschema.xml index 7a269bf32..8a174d2e0 100644 --- a/data/io.elementary.monitor.gschema.xml +++ b/data/io.elementary.monitor.gschema.xml @@ -60,11 +60,6 @@ To show network down bandwidth in Monitor Indicator or not To show network down bandwidth in Monitor Indicator or not - - false - To show network bandwidth in in bits instead of bytes per second - To show network bandwidth in in bits instead of bytes per second - false To show GPU used percentage in Monitor Indicator or not diff --git a/src/Indicator/Services/DBusClient.vala b/src/Indicator/Services/DBusClient.vala index 50ab4424c..5b20140f9 100644 --- a/src/Indicator/Services/DBusClient.vala +++ b/src/Indicator/Services/DBusClient.vala @@ -15,7 +15,6 @@ public interface Monitor.DBusClientInterface : Object { public signal void indicator_memory_state (bool state); public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); - public signal void network_use_bits_state (bool state); public signal void indicator_gpu_state (bool state); public signal void indicator_gpu_memory_state (bool state); public signal void indicator_gpu_temperature_state (bool state); diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala index c104a645e..01fca412c 100644 --- a/src/Indicator/Widgets/DisplayWidget.vala +++ b/src/Indicator/Widgets/DisplayWidget.vala @@ -29,9 +29,6 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Box { memory_widget.visible = Indicator.settings.get_boolean ("indicator-memory-state"); network_up_widget.visible = Indicator.settings.get_boolean ("indicator-network-upload-state"); network_down_widget.visible = Indicator.settings.get_boolean ("indicator-network-download-state"); - bool use_bits = Indicator.settings.get_boolean ("network-use-bits-state"); - network_up_widget.use_bits = use_bits; - network_down_widget.use_bits = use_bits; gpu_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-state"); gpu_memory_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-memory-state"); gpu_temperature_widget.visible = Indicator.settings.get_boolean ("indicator-gpu-temperature-state"); @@ -43,10 +40,6 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Box { dbusclient.interface.indicator_memory_state.connect ((state) => memory_widget.visible = state); dbusclient.interface.indicator_network_up_state.connect ((state) => network_up_widget.visible = state); dbusclient.interface.indicator_network_down_state.connect ((state) => network_down_widget.visible = state); - dbusclient.interface.network_use_bits_state.connect ((state) => { - network_up_widget.use_bits = state; - network_down_widget.use_bits = state; - }); dbusclient.interface.indicator_gpu_state.connect ((state) => gpu_widget.visible = state); dbusclient.interface.indicator_gpu_memory_state.connect ((state) => gpu_memory_widget.visible = state); dbusclient.interface.indicator_gpu_temperature_state.connect ((state) => gpu_temperature_widget.visible = state); diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index f0b3a64e9..f5e8f4ffb 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -4,8 +4,6 @@ */ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { - public bool use_bits = false; - public IndicatorWidgetBandwidth (string icon_name) { base (icon_name); } @@ -13,6 +11,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = Utils.Strings.format_network_speed (bandwidth, use_bits); + label.label = Utils.Strings.format_network_speed (bandwidth, true); } } diff --git a/src/Services/DBusServer.vala b/src/Services/DBusServer.vala index 824133f43..ddad83862 100644 --- a/src/Services/DBusServer.vala +++ b/src/Services/DBusServer.vala @@ -22,7 +22,6 @@ public class Monitor.DBusServer : Object { public signal void indicator_memory_state (bool state); public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); - public signal void network_use_bits_state (bool state); public signal void indicator_gpu_state (bool state); public signal void indicator_gpu_memory_state (bool state); public signal void indicator_gpu_temperature_state (bool state); diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index 23e2cc516..fcb82da1f 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -89,11 +89,6 @@ public class Monitor.PreferencesView : Granite.Bin { dbusserver.indicator_network_down_state (network_download_check.active); }); - var network_use_bits_check = new Gtk.CheckButton.with_label (_("Network use bits")); - network_use_bits_check.toggled.connect (() => { - dbusserver.network_use_bits_state (network_use_bits_check.active); - }); - var gpu_check = new Gtk.CheckButton.with_label (_("GPU percentage")); gpu_check.toggled.connect (() => { dbusserver.indicator_gpu_state (gpu_check.active); @@ -129,7 +124,6 @@ public class Monitor.PreferencesView : Granite.Bin { indicator_options_box.append (new Gtk.Separator (HORIZONTAL)); indicator_options_box.append (network_upload_check); indicator_options_box.append (network_download_check); - indicator_options_box.append (network_use_bits_check); var indicator_options_revealer = new Gtk.Revealer () { child = indicator_options_box @@ -164,6 +158,5 @@ public class Monitor.PreferencesView : Granite.Bin { settings.bind ("indicator-gpu-state", gpu_check, "active", DEFAULT); settings.bind ("indicator-network-download-state", network_download_check, "active", DEFAULT); settings.bind ("indicator-network-upload-state", network_upload_check, "active", DEFAULT); - settings.bind ("network-use-bits-state", network_use_bits_check, "active", DEFAULT); } } diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 7e405849f..94da7909f 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -11,8 +11,6 @@ public class Monitor.SystemNetworkView : Gtk.Grid { private LabelRoundy network_upload_label; private LabelRoundy network_download_label; - public bool use_bits = false; - construct { margin_top = 12; margin_bottom = 12; @@ -62,8 +60,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = Utils.Strings.format_network_speed ((uint64) down_bytes, use_bits); - network_upload_label.text = Utils.Strings.format_network_speed ((uint64) up_bytes, use_bits); + network_download_label.text = Utils.Strings.format_network_speed ((uint64) down_bytes, true); + network_upload_label.text = Utils.Strings.format_network_speed ((uint64) up_bytes, true); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index 0cedb2811..43906b3c1 100644 --- a/src/Views/SystemView/SystemView.vala +++ b/src/Views/SystemView/SystemView.vala @@ -50,13 +50,6 @@ public class Monitor.SystemView : Gtk.Box { } append (scrolled_window); - - unowned var dbusclient = DBusClient.get_default (); - dbusclient.interface.network_use_bits_state.connect ((state) => { - network_view.use_bits = state; - }); - Settings settings = new Settings ("io.elementary.monitor.settings"); - network_view.use_bits = settings.get_boolean ("network-use-bits-state"); } public void update () { diff --git a/src/meson.build b/src/meson.build index b3dcc7120..036d04339 100644 --- a/src/meson.build +++ b/src/meson.build @@ -48,7 +48,6 @@ source_app_files = [ # Services 'Services/DBusServer.vala', 'Services/Appearance.vala', - 'Indicator/Services/DBusClient.vala', # Resources 'Resources/Resources.vala', From 2b18d0773d73130e8d18f642aa972efa12a16dcb Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:08:33 +0530 Subject: [PATCH 03/10] Use glib format_size instead of custom util function --- .../Widgets/IndicatorWidgetBandwidth.vala | 2 +- src/Utils.vala | 17 ++--------------- src/Views/SystemView/SystemNetworkView.vala | 4 ++-- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index f5e8f4ffb..986f9ba88 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -11,6 +11,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = Utils.Strings.format_network_speed (bandwidth, true); + label.label = format_size (bandwidth * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); } } diff --git a/src/Utils.vala b/src/Utils.vala index a301467a2..ac689154d 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -4,6 +4,8 @@ */ namespace Monitor.Utils { + const int BITS_IN_BYTES = 8; + const string NOT_AVAILABLE = (_("N/A")); const string NO_DATA = "\u2014"; @@ -49,21 +51,6 @@ public class Monitor.Utils.Strings { return pretty; } - public static string format_network_speed (uint64 bandwidth, bool use_bits = false) { - const int SCALE = 1000; - bandwidth = bandwidth * (use_bits ? 8 : 1); - string unit_suffix = use_bits ? "bps" : "Bps"; - string[] units = { "", "K", "M", "G", "T" }; - - int unit_index = 0; - - while (bandwidth >= SCALE && unit_index < units.length - 1) { - bandwidth /= SCALE; - unit_index++; - } - - return "%llu %s%s".printf (bandwidth, units[unit_index], unit_suffix); - } } public class Monitor.Utils.Colors : Object { diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 94da7909f..1e99c4c02 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -60,8 +60,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = Utils.Strings.format_network_speed ((uint64) down_bytes, true); - network_upload_label.text = Utils.Strings.format_network_speed ((uint64) up_bytes, true); + network_download_label.text = format_size ((uint64) down_bytes * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); + network_upload_label.text = format_size ((uint64) up_bytes * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } From 1bedfbaba65cb36b6189c77e097e8e42a8bd03cf Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:15:29 +0530 Subject: [PATCH 04/10] Back to original format string --- src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 2 +- src/Views/SystemView/SystemNetworkView.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index 986f9ba88..b2233028d 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -11,6 +11,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = format_size (bandwidth * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); + label.label = format_size (bandwidth * Utils.BITS_IN_BYTES, BITS); } } diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 1e99c4c02..9b3595869 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -60,8 +60,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = format_size ((uint64) down_bytes * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); - network_upload_label.text = format_size ((uint64) up_bytes * Monitor.Utils.BITS_IN_BYTES, FormatSizeFlags.BITS); + network_download_label.text = ("%s/s").printf (format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS)); + network_upload_label.text = ("%s/s").printf (format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS)); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } From 2c0e5fe3db26f97308ba68b07f76b0048b950d0b Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:28:20 +0530 Subject: [PATCH 05/10] Use IEC_UNITS for net speed but keep non IEC for displayed unit This is to match the speeds shown on speed test websites but avoid using IEC units like "MiB/s" (avoid showing the lowercase letter I) and keep units like "Mb/s". --- src/Views/SystemView/SystemNetworkView.vala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 9b3595869..c146075fc 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -60,8 +60,14 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = ("%s/s").printf (format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS)); - network_upload_label.text = ("%s/s").printf (format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS)); + network_download_label.text = ("%s %s/s").printf ( + format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); + network_upload_label.text = ("%s %s/s").printf ( + format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } From 4fe8c2e3d4f7ed668960f0d9766c9fc9ffc892ff Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:31:23 +0530 Subject: [PATCH 06/10] Match indicator net speed displayed text to system view format --- src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index b2233028d..805f96394 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -11,6 +11,9 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = format_size (bandwidth * Utils.BITS_IN_BYTES, BITS); + label.label = ("%s %s/s").printf ( + format_size ((uint64) bandwidth * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size ((uint64) bandwidth * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); } } From b0e8feee2d89b611cc1156d67ff90d7ef64fa74b Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:39:40 +0530 Subject: [PATCH 07/10] DRY net speed format to a util function --- src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 5 +---- src/Utils.vala | 6 ++++++ src/Views/SystemView/SystemNetworkView.vala | 10 ++-------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index 805f96394..75bdad803 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -11,9 +11,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = ("%s %s/s").printf ( - format_size ((uint64) bandwidth * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), - format_size ((uint64) bandwidth * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) - ); + label.label = Utils.Strings.format_network_speed (bandwidth); } } diff --git a/src/Utils.vala b/src/Utils.vala index ac689154d..c0abb3073 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -51,6 +51,12 @@ public class Monitor.Utils.Strings { return pretty; } + public static string format_network_speed (uint64 speed) { + return ("%s %s/s").printf ( + format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); + } } public class Monitor.Utils.Colors : Object { diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index c146075fc..dd5d1fb7d 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -60,14 +60,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { double up_bytes = network.bytes_out; double down_bytes = network.bytes_in; if (up_bytes >= 0 && down_bytes >= 0) { - network_download_label.text = ("%s %s/s").printf ( - format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), - format_size ((uint64) down_bytes * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) - ); - network_upload_label.text = ("%s %s/s").printf ( - format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), - format_size ((uint64) up_bytes * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) - ); + network_download_label.text = Utils.Strings.format_network_speed ((uint64) down_bytes); + network_upload_label.text = Utils.Strings.format_network_speed ((uint64) up_bytes); network_chart.update (0, up_bytes); network_chart.update (1, down_bytes); } From cb5438f209dffcb216f85cf62a91f400135d079b Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 09:50:59 +0530 Subject: [PATCH 08/10] Handle RTL (and LTR) text directions for net speed --- src/Utils.vala | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index c0abb3073..c1cd5a703 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -52,10 +52,17 @@ public class Monitor.Utils.Strings { } public static string format_network_speed (uint64 speed) { - return ("%s %s/s").printf ( - format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), - format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) - ); + if (Gtk.Widget.get_default_direction () == Gtk.TextDirection.LTR) { + return ("%s %s/s").printf ( + format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); + } else { + return ("%s/s %s").printf ( + format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT), + format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE) + ); + } } } From af8063b5764fd54df812101dd690b28bb99b4a34 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 09:45:36 +0530 Subject: [PATCH 09/10] Address review comments about translation --- src/Utils.vala | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index c1cd5a703..dae682162 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -52,17 +52,12 @@ public class Monitor.Utils.Strings { } public static string format_network_speed (uint64 speed) { - if (Gtk.Widget.get_default_direction () == Gtk.TextDirection.LTR) { - return ("%s %s/s").printf ( - format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), - format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) - ); - } else { - return ("%s/s %s").printf ( - format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT), - format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE) - ); - } + ///TRANSLATORS: The first param is the numeric value (as string) of network speed. + ///The second param with the appended "/s" is the network speed unit such as "Mb/s" for megabits per second. + return _("%1$s %2$s/s").printf ( + format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) + ); } } From 9bbe887f4d0bedaf32fef8d72259fbf2eedb7d69 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 17:48:34 +0530 Subject: [PATCH 10/10] Address latest review comment about translation --- src/Utils.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils.vala b/src/Utils.vala index dae682162..379fa66e6 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -54,7 +54,7 @@ public class Monitor.Utils.Strings { public static string format_network_speed (uint64 speed) { ///TRANSLATORS: The first param is the numeric value (as string) of network speed. ///The second param with the appended "/s" is the network speed unit such as "Mb/s" for megabits per second. - return _("%1$s %2$s/s").printf ( + return _("%s %s/s").printf ( format_size (speed * Utils.BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), format_size (speed * Utils.BITS_IN_BYTES, BITS | ONLY_UNIT) );