From c5b66fae62b7e291092106ebe8151117284b2bb2 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 22:11:00 +0530 Subject: [PATCH 01/11] Fixup abstract method --- src/Indicator/Widgets/IndicatorWidget.vala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidget.vala b/src/Indicator/Widgets/IndicatorWidget.vala index 80301e90..51b1c7bf 100644 --- a/src/Indicator/Widgets/IndicatorWidget.vala +++ b/src/Indicator/Widgets/IndicatorWidget.vala @@ -32,7 +32,5 @@ public class Monitor.IndicatorWidget : Gtk.Box { append (label); } - public virtual void update_label (Value value) { - // NOP; should be overridden by child classes - } + public abstract void update_label (Value value); } From cec20c5252d486f6a66db12ddadb9a61bdb78e56 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 22:11:53 +0530 Subject: [PATCH 02/11] Swap positions of network indicator widgets --- src/Indicator/Widgets/DisplayWidget.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala index 01fca412..9a8becd7 100644 --- a/src/Indicator/Widgets/DisplayWidget.vala +++ b/src/Indicator/Widgets/DisplayWidget.vala @@ -89,7 +89,7 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Box { append (gpu_widget); append (gpu_memory_widget); append (gpu_temperature_widget); - append (network_up_widget); append (network_down_widget); + append (network_up_widget); } } From 19d29e71433ac5e4fc961114944d4ce026d1911f Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 22:57:46 +0530 Subject: [PATCH 03/11] Revert "Fixup abstract method" This reverts commit c5b66fae62b7e291092106ebe8151117284b2bb2. --- src/Indicator/Widgets/IndicatorWidget.vala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Indicator/Widgets/IndicatorWidget.vala b/src/Indicator/Widgets/IndicatorWidget.vala index 51b1c7bf..80301e90 100644 --- a/src/Indicator/Widgets/IndicatorWidget.vala +++ b/src/Indicator/Widgets/IndicatorWidget.vala @@ -32,5 +32,7 @@ public class Monitor.IndicatorWidget : Gtk.Box { append (label); } - public abstract void update_label (Value value); + public virtual void update_label (Value value) { + // NOP; should be overridden by child classes + } } From 5b667164199328874716bbfcb37e7f4b8d164116 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 23:19:32 +0530 Subject: [PATCH 04/11] Add custom format for network bandwidth --- .../Widgets/IndicatorWidgetBandwidth.vala | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index e58b3a2f..364349bc 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -11,6 +11,22 @@ 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 = format_network_speed (bandwidth); + } + + private 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); } } From 0127f8fe0c008b1a7afe0bfcabd2edd7e44ca283 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 23:37:13 +0530 Subject: [PATCH 05/11] Increase network indicator label width to avoid visual shifts --- src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index 364349bc..3e3630fe 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -8,6 +8,10 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { base (icon_name); } + construct { + label.width_chars = 8; + } + public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); From 9e20c6ca6cbce475f1bcc55dbd3737cd5894738d Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 24 Aug 2026 23:40:03 +0530 Subject: [PATCH 06/11] Swap positions of network checkboxes in prefs view --- src/Views/PreferencesView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index fcb82da1..ee2d1e88 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -122,8 +122,8 @@ public class Monitor.PreferencesView : Granite.Bin { indicator_options_box.append (gpu_memory_check); indicator_options_box.append (gpu_temp_check); 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_upload_check); var indicator_options_revealer = new Gtk.Revealer () { child = indicator_options_box From 49e086045797b3457fd5b7ce038e48e8dab86bd1 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 00:14:38 +0530 Subject: [PATCH 07/11] Add use-bits network preference and update indicator --- data/io.elementary.monitor.gschema.xml | 5 +++++ src/Indicator/Services/DBusClient.vala | 1 + src/Indicator/Widgets/DisplayWidget.vala | 7 +++++++ src/Indicator/Widgets/IndicatorWidgetBandwidth.vala | 6 ++++-- src/Services/DBusServer.vala | 1 + src/Views/PreferencesView.vala | 7 +++++++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/data/io.elementary.monitor.gschema.xml b/data/io.elementary.monitor.gschema.xml index 8a174d2e..681f586b 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 5b20140f..604dfb94 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 indicator_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 9a8becd7..51845d7a 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 ("indicator-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.indicator_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 3e3630fe..12671cb0 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); } @@ -15,10 +17,10 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = format_network_speed (bandwidth); + label.label = format_network_speed (bandwidth, use_bits); } - private string format_network_speed (uint64 bandwidth, bool use_bits = false) { + public 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"; diff --git a/src/Services/DBusServer.vala b/src/Services/DBusServer.vala index ddad8386..234f9b09 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 indicator_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 ee2d1e88..2e04ada6 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.indicator_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_download_check); indicator_options_box.append (network_upload_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 ("indicator-network-use-bits-state", network_use_bits_check, "active", DEFAULT); } } From 56e1c55c06878bcf2635eb0890d7208ff5e579b4 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 00:16:55 +0530 Subject: [PATCH 08/11] Move custom bandwidth format method to string utils --- .../Widgets/IndicatorWidgetBandwidth.vala | 18 +----------------- src/Utils.vala | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala index 12671cb0..69028db4 100644 --- a/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala +++ b/src/Indicator/Widgets/IndicatorWidgetBandwidth.vala @@ -17,22 +17,6 @@ public class Monitor.IndicatorWidgetBandwidth : Monitor.IndicatorWidget { public override void update_label (Value value) { uint64 bandwidth = value.get_uint64 (); - label.label = format_network_speed (bandwidth, use_bits); - } - - public 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); + label.label = Utils.Strings.format_network_speed (bandwidth, use_bits); } } diff --git a/src/Utils.vala b/src/Utils.vala index 6a8cfe1d..a301467a 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 { From 3fedd964dcd0466fcde2a13052ab274e1f246889 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 00:34:18 +0530 Subject: [PATCH 09/11] Enable use-bits option for system network view chart lables --- src/Views/SystemView/SystemNetworkView.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 1a4c5ef6..7e405849 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); } From a505cdf775f497a07db28c378b7048100d652c3f Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 00:47:57 +0530 Subject: [PATCH 10/11] Enable system network chart label use-bits formatting --- src/Views/SystemView/SystemView.vala | 7 +++++++ src/meson.build | 1 + 2 files changed, 8 insertions(+) diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index 43906b3c..4f969bc3 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.indicator_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 ("indicator-network-use-bits-state"); } public void update () { diff --git a/src/meson.build b/src/meson.build index 036d0433..b3dcc712 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 4d1ac554f0348c89d1af1c98aff5bba349b648fa Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 01:13:17 +0530 Subject: [PATCH 11/11] Show sub-GHz CPU frequency in MHz instead of always GHz --- src/Indicator/Widgets/IndicatorWidgetFrequency.vala | 6 +++++- src/Resources/CPU.vala | 4 ++-- src/Utils.vala | 8 ++++++++ src/Views/SystemView/SystemCPUView.vala | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetFrequency.vala b/src/Indicator/Widgets/IndicatorWidgetFrequency.vala index a9b91f13..03760ce0 100644 --- a/src/Indicator/Widgets/IndicatorWidgetFrequency.vala +++ b/src/Indicator/Widgets/IndicatorWidgetFrequency.vala @@ -8,9 +8,13 @@ public class Monitor.IndicatorWidgetFrequency : Monitor.IndicatorWidget { base (icon_name); } + construct { + label.width_chars = 8; + } + public override void update_label (Value value) { double frequency = value.get_double (); - label.label = ("%.2f %s").printf (frequency, _("GHz")); + label.label = Utils.Strings.format_frequency (frequency); } } diff --git a/src/Resources/CPU.vala b/src/Resources/CPU.vala index 7b3aae88..f3fcdb7f 100644 --- a/src/Resources/CPU.vala +++ b/src/Resources/CPU.vala @@ -44,8 +44,8 @@ public class Monitor.CPU : Object { private double _frequency; public double frequency { get { - // Convert kHz to GHz - return (double) (_frequency / 1000000); + // Convert kHz to MHz + return (double) (_frequency / 1000); } } public double temperature_mean { diff --git a/src/Utils.vala b/src/Utils.vala index a301467a..95dcefdb 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -64,6 +64,14 @@ public class Monitor.Utils.Strings { return "%llu %s%s".printf (bandwidth, units[unit_index], unit_suffix); } + + public static string format_frequency (double mhz) { + if (mhz >= 1000.0) { + return "%.2f %s".printf (mhz / 1000.0, _("GHz")); + } + + return "%.0f %s".printf (mhz, _("MHz")); + } } public class Monitor.Utils.Colors : Object { diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index e8a4e471..13aada0a 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -126,7 +126,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { } main_metric_value = ("%d%%").printf (cpu.percentage); - cpu_frequency_label.text = ("%.2f %s").printf (cpu.frequency, _("GHz")); + cpu_frequency_label.text = Utils.Strings.format_frequency (cpu.frequency); } private Gtk.Grid grid_core_labels () {