From 7759eca8869ddaba159f9fbe95733ac2f4f73927 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Mon, 14 Sep 2026 20:54:35 +0530 Subject: [PATCH 1/3] Show CPU count, cores and threads in a tooltip Also presume the same CPU model for multi-socket so only show single line with model name instead of one line per physical CPU. --- src/Views/HardwareView.vala | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index ff2e2669..dfbab535 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -14,6 +14,9 @@ public class About.HardwareView : Gtk.Box { private string manufacturer_support_url; private string memory; private string processor; + private uint physical_cpus; + private uint physical_cores_per_cpu; + private uint logical_threads_per_cpu; private string product_name; private string product_version; private SystemInterface system_interface; @@ -54,6 +57,10 @@ public class About.HardwareView : Gtk.Box { ellipsize = MIDDLE, margin_top = 12, selectable = true, + tooltip_text = _( + "CPUs: %u\n\nCores per CPU: %u\n\nThreads per CPU: %u").printf ( + physical_cpus, physical_cores_per_cpu, logical_threads_per_cpu + ), xalign = 0 }; @@ -229,7 +236,7 @@ public class About.HardwareView : Gtk.Box { return ARMPartDecoder.decode_arm_model (cpu_implementer, cpu_part); } - private string? get_cpu_info () { + private string? get_cpu_info (out uint cpus, out uint cores, out uint threads) { unowned GLibTop.sysinfo? info = GLibTop.get_sysinfo (); if (info == null) { @@ -276,26 +283,21 @@ public class About.HardwareView : Gtk.Box { string result = ""; foreach (var cpu in counts.entries) { - if (result.length > 0) { - result += "\n"; - } - string cpu_name = _("Unknown Processor"); if (cpu.key.length > 0) { cpu_name = clean_name (cpu.key); } - if (cpu.@value == 2) { - result += _("Dual-Core %s").printf (cpu_name); - } else if (cpu.@value == 4) { - result += _("Quad-Core %s").printf (cpu_name); - } else if (cpu.@value == 6) { - result += _("Hexa-Core %s").printf (cpu_name); - } else { - result += "%u \u00D7 %s ".printf (cpu.@value, cpu_name); - } + cores = cpu.@value; + + result = "%s".printf (cpu_name); + + break; } + cpus = counts.size; + threads = (uint) info.ncpu / cpus; + return result; } @@ -399,7 +401,11 @@ public class About.HardwareView : Gtk.Box { } private void fetch_hardware_info () { - string? cpu = get_cpu_info (); + string? cpu = get_cpu_info ( + out physical_cpus, + out physical_cores_per_cpu, + out logical_threads_per_cpu + ); if (cpu == null) { processor = _("Unknown Processor"); From bda59829721ea0e0b7cd7d37f76a1b6689c8531f Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 15 Sep 2026 09:29:51 +0530 Subject: [PATCH 2/3] Address review comment to not use tooltip Place processor details in a popover on a info button. --- src/Views/HardwareView.vala | 47 +++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index dfbab535..6489fca4 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -57,13 +57,35 @@ public class About.HardwareView : Gtk.Box { ellipsize = MIDDLE, margin_top = 12, selectable = true, - tooltip_text = _( - "CPUs: %u\n\nCores per CPU: %u\n\nThreads per CPU: %u").printf ( - physical_cpus, physical_cores_per_cpu, logical_threads_per_cpu - ), xalign = 0 }; + var processor_details = new Gtk.Box (VERTICAL, 0) { + focusable = false + }; + + processor_details.append (label (_("CPUs:") + " %u".printf (physical_cpus))); + processor_details.append (label (_("Cores per CPU:") + " %u".printf (physical_cores_per_cpu))); + processor_details.append (label (_("Threads per CPU:") + " %u".printf (logical_threads_per_cpu))); + + var processor_popover = new Gtk.Popover () { + child = processor_details, + position = BOTTOM + }; + + var processor_button = new Gtk.MenuButton () { + halign = START, + valign = END, + focusable = false, + icon_name = "dialog-information", + popover = processor_popover + }; + processor_button.add_css_class (Granite.CssClass.CIRCULAR); + + var processor_box = new Gtk.Box (HORIZONTAL, 0); + processor_box.append (processor_info); + processor_box.append (processor_button); + var memory_info = new Gtk.Label (_("%s memory").printf (memory)) { ellipsize = MIDDLE, selectable = true, @@ -122,7 +144,7 @@ public class About.HardwareView : Gtk.Box { update_manufacturer_logo (); - details_box.append (processor_info); + details_box.append (processor_box); details_box.append (graphics_box); details_box.append (memory_info); @@ -177,6 +199,21 @@ public class About.HardwareView : Gtk.Box { }); } + private Gtk.Label label (string text) { + var label = new Gtk.Label (text) { + halign = Gtk.Align.START, + valign = Gtk.Align.END, + wrap = true, + selectable = false, + margin_top = 6, + margin_bottom = 0, + margin_start = 6, + margin_end = 6, + }; + + return label; + } + private void on_hostname_entry_activate () { hostname_entry.secondary_icon_name = "process-working-symbolic"; hostname_entry.add_css_class ("spin"); From 1603b150bfd5b1c31f9918e83ee831dd8ddaa995 Mon Sep 17 00:00:00 2001 From: Vishal Rao Date: Tue, 22 Sep 2026 09:53:55 +0530 Subject: [PATCH 3/3] Fix likely i18n string format issues --- src/Views/HardwareView.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index 6489fca4..383dc044 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -64,9 +64,9 @@ public class About.HardwareView : Gtk.Box { focusable = false }; - processor_details.append (label (_("CPUs:") + " %u".printf (physical_cpus))); - processor_details.append (label (_("Cores per CPU:") + " %u".printf (physical_cores_per_cpu))); - processor_details.append (label (_("Threads per CPU:") + " %u".printf (logical_threads_per_cpu))); + processor_details.append (label (_("CPUs: %u").printf (physical_cpus))); + processor_details.append (label (_("Cores per CPU: %u").printf (physical_cores_per_cpu))); + processor_details.append (label (_("Threads per CPU: %u").printf (logical_threads_per_cpu))); var processor_popover = new Gtk.Popover () { child = processor_details,