From bd4217d553ff25a5e30cc5bbdcff423695c6e16d Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 25 Aug 2026 08:57:48 +0530 Subject: [PATCH 01/10] Show sub-GHz CPU frequency in MHz instead of always GHz --- src/Indicator/Widgets/IndicatorWidgetFrequency.vala | 2 +- src/Resources/CPU.vala | 4 ++-- src/Utils.vala | 7 +++++++ src/Views/SystemView/SystemCPUView.vala | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Indicator/Widgets/IndicatorWidgetFrequency.vala b/src/Indicator/Widgets/IndicatorWidgetFrequency.vala index a9b91f135..5aabb5def 100644 --- a/src/Indicator/Widgets/IndicatorWidgetFrequency.vala +++ b/src/Indicator/Widgets/IndicatorWidgetFrequency.vala @@ -11,6 +11,6 @@ public class Monitor.IndicatorWidgetFrequency : Monitor.IndicatorWidget { 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 7b3aae88d..f3fcdb7fb 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 6a8cfe1d0..fc5113394 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -49,6 +49,13 @@ public class Monitor.Utils.Strings { return pretty; } + 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 e8a4e471d..13aada0a2 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 () { From 60056b3505179e2f0698b159f1af7c0f2045c0b6 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 10:23:54 +0530 Subject: [PATCH 02/10] Fix CPU chart graph scaling --- src/Views/SystemView/SystemCPUView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 13aada0a2..dd301358f 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -54,7 +54,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { height_request = -1 }; cpu_frequency_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_500)); - cpu_frequency_chart.config.y_axis.fixed_max = 5.0; + cpu_frequency_chart.config.y_axis.fixed_max = 5000.0; var freq_info_overlay = new Gtk.Overlay () { child = cpu_frequency_chart From 9aa933ea1d3bb5ba2fff8a6b429693cb19fee55f Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 10:44:05 +0530 Subject: [PATCH 03/10] Handle RTL (and LTR) text directions for CPU frequency --- src/Utils.vala | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index fc5113394..30ab3f758 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -50,11 +50,24 @@ public class Monitor.Utils.Strings { } public static string format_frequency (double mhz) { + double frequency = mhz; + string unit = _("Mhz"); + string format_value = "%.0f"; + if (mhz >= 1000.0) { - return "%.2f %s".printf (mhz / 1000.0, _("GHz")); + frequency = mhz / 1000.0; + unit = _("Ghz"); + format_value = "%.2f"; } - return "%.0f %s".printf (mhz, _("MHz")); + string format = format_value + " %s"; + + if (Gtk.Widget.get_default_direction () == Gtk.TextDirection.LTR) { + return format.printf (frequency, unit); + } else { + format = "%s " + format_value; + return format.printf (unit, frequency); + } } } From 7a2c36ee7bc72bc4d4fb4ad82a8d72ff0076cfc1 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 12:26:08 +0530 Subject: [PATCH 04/10] Scale chart to 7 ghz for next gen consumer CPUs --- src/Views/SystemView/SystemCPUView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index dd301358f..bd4a9a2ad 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -54,7 +54,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { height_request = -1 }; cpu_frequency_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_500)); - cpu_frequency_chart.config.y_axis.fixed_max = 5000.0; + cpu_frequency_chart.config.y_axis.fixed_max = 7000.0; var freq_info_overlay = new Gtk.Overlay () { child = cpu_frequency_chart From bd9dffaa426abc8fb36ebecd748b7249ce59cf09 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 11:58:36 +0530 Subject: [PATCH 05/10] Fixup translation in util function --- src/Utils.vala | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index 30ab3f758..52f7f0aad 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -50,24 +50,16 @@ public class Monitor.Utils.Strings { } public static string format_frequency (double mhz) { - double frequency = mhz; - string unit = _("Mhz"); - string format_value = "%.0f"; - if (mhz >= 1000.0) { - frequency = mhz / 1000.0; - unit = _("Ghz"); - format_value = "%.2f"; + mhz /= 1000.0; + ///TRANSLATORS: The first param is the cpu frequency speed value and + ///the second param is the cpu frequency speed unit viz. "Ghz" for gigahertz. + return "%1$.2f %2$s".printf (mhz, _("Ghz")); } - string format = format_value + " %s"; - - if (Gtk.Widget.get_default_direction () == Gtk.TextDirection.LTR) { - return format.printf (frequency, unit); - } else { - format = "%s " + format_value; - return format.printf (unit, frequency); - } + ///TRANSLATORS: The first param is the cpu frequency speed value and + ///the second param is the cpu frequency speed unit viz. "Mhz" for megahertz. + return "%1$.0f %2$s".printf (mhz, _("Mhz")); } } From 724fa666ae7e9f8d6439aa7cfce828017f4a7b89 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 17:50:49 +0530 Subject: [PATCH 06/10] Avoid positional args in translation --- src/Utils.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index 52f7f0aad..e3a66e549 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -54,12 +54,12 @@ public class Monitor.Utils.Strings { mhz /= 1000.0; ///TRANSLATORS: The first param is the cpu frequency speed value and ///the second param is the cpu frequency speed unit viz. "Ghz" for gigahertz. - return "%1$.2f %2$s".printf (mhz, _("Ghz")); + return "%.2f %s".printf (mhz, _("Ghz")); } ///TRANSLATORS: The first param is the cpu frequency speed value and ///the second param is the cpu frequency speed unit viz. "Mhz" for megahertz. - return "%1$.0f %2$s".printf (mhz, _("Mhz")); + return "%.0f %s".printf (mhz, _("Mhz")); } } From 3a32e82166c8ea48bd0eab6c1217a63d56900edc Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 19:34:16 +0530 Subject: [PATCH 07/10] Address latest review comments --- src/Utils.vala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index e3a66e549..d3a95169d 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -50,16 +50,17 @@ public class Monitor.Utils.Strings { } public static string format_frequency (double mhz) { - if (mhz >= 1000.0) { - mhz /= 1000.0; + var frequency = mhz; + if (frequency >= 1000) { + frequency /= 1000; ///TRANSLATORS: The first param is the cpu frequency speed value and ///the second param is the cpu frequency speed unit viz. "Ghz" for gigahertz. - return "%.2f %s".printf (mhz, _("Ghz")); + return _("%.2f Ghz").printf (frequency); } ///TRANSLATORS: The first param is the cpu frequency speed value and ///the second param is the cpu frequency speed unit viz. "Mhz" for megahertz. - return "%.0f %s".printf (mhz, _("Mhz")); + return _("%.0f Mhz").printf (frequency); } } From 001170a4e6aadbe13891f4682d130b42911e4319 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 19:46:18 +0530 Subject: [PATCH 08/10] Forgot to address 'make 1000 a const' feedback --- src/Utils.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index 41f634d90..ef4562936 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -5,6 +5,7 @@ namespace Monitor.Utils { const int BITS_IN_BYTES = 8; + const int MHZ_IN_GHZ = 1000; const string NOT_AVAILABLE = (_("N/A")); const string NO_DATA = "\u2014"; @@ -53,8 +54,8 @@ public class Monitor.Utils.Strings { public static string format_frequency (double mhz) { var frequency = mhz; - if (frequency >= 1000) { - frequency /= 1000; + if (frequency >= MHZ_IN_GHZ) { + frequency /= MHZ_IN_GHZ; ///TRANSLATORS: The first param is the cpu frequency speed value and ///the second param is the cpu frequency speed unit viz. "Ghz" for gigahertz. return _("%.2f Ghz").printf (frequency); From 82e63ad4d4f4dbe4494247013c137efad3a41070 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 19:51:18 +0530 Subject: [PATCH 09/10] Hand out a freebie while we're here --- src/Utils.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utils.vala b/src/Utils.vala index ef4562936..e1bb59859 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -66,12 +66,12 @@ public class Monitor.Utils.Strings { return _("%.0f Mhz").printf (frequency); } - public static string format_network_speed (uint64 speed) { + public static string format_network_speed (uint64 speed_in_bytes_per_second) { ///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 _("%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) + format_size (speed_in_bytes_per_second * BITS_IN_BYTES, BITS | IEC_UNITS | ONLY_VALUE), + format_size (speed_in_bytes_per_second * BITS_IN_BYTES, BITS | ONLY_UNIT) ); } } From 3305fd83fb2aff6ba4f2aaea026f0775da672785 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 21:56:42 +0530 Subject: [PATCH 10/10] Fix chart colouring glitch due to large y-axis scale --- src/Views/SystemView/SystemCPUView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index bd4a9a2ad..c125bb5bf 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -54,7 +54,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { height_request = -1 }; cpu_frequency_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_500)); - cpu_frequency_chart.config.y_axis.fixed_max = 7000.0; + cpu_frequency_chart.config.y_axis.fixed_max = 7.0; var freq_info_overlay = new Gtk.Overlay () { child = cpu_frequency_chart @@ -77,7 +77,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { } public void update () { - cpu_frequency_chart.update (0, cpu.frequency); + cpu_frequency_chart.update (0, cpu.frequency / Utils.MHZ_IN_GHZ); cpu_temperature_chart.update (0, cpu.temperature_mean); cpu_temperature_label.text = ("%.2f %s").printf (cpu.temperature_mean, _("℃"));