From a355d897f665f4cb2dbab7a3f11b8dd244bc4b9c Mon Sep 17 00:00:00 2001 From: v81d Date: Mon, 16 Feb 2026 18:10:01 -0500 Subject: [PATCH 1/5] feat: add switch to hide unimportant devices --- src/ui/preferences-dialog.blp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ui/preferences-dialog.blp b/src/ui/preferences-dialog.blp index 67d9eb3..9fa97ac 100644 --- a/src/ui/preferences-dialog.blp +++ b/src/ui/preferences-dialog.blp @@ -5,6 +5,15 @@ Adw.PreferencesDialog preferences_dialog { Adw.PreferencesPage { title: _("General"); + Adw.PreferencesGroup { + title: _("Devices"); + + Adw.SwitchRow trivial_devices_switch { + title: _("Show Trivial Devices"); + subtitle: _("Show or hide devices that do not report much information."); + } + } + Adw.PreferencesGroup { title: _("Automation"); From d8869c3d968aaa4a41a785a1aed6e126a7279cc9 Mon Sep 17 00:00:00 2001 From: v81d Date: Mon, 16 Feb 2026 18:14:10 -0500 Subject: [PATCH 2/5] feat: edit schema --- data/io.github.v81d.Wattage.gschema.xml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/data/io.github.v81d.Wattage.gschema.xml b/data/io.github.v81d.Wattage.gschema.xml index f806e39..49c5945 100644 --- a/data/io.github.v81d.Wattage.gschema.xml +++ b/data/io.github.v81d.Wattage.gschema.xml @@ -1,31 +1,36 @@ + + false + Show trivial devices + Show or hide devices that do not report much information. + true Enable auto-refresh - Whether the app automatically refreshes data. + Whether or not the data should refresh automatically. 20 Auto-refresh cooldown - Interval, in seconds, between auto-refresh operations. + The time, in seconds, between each data refresh. 'Wh' Energy unit - The unit used to display energy measurements. + The unit for energy measurements. 'W' Power unit - The unit used to display power measurements. + The unit for power measurements. 'V' Voltage unit - The unit used to display voltage measurements. + The unit for voltage measurements. 'rate' From 58918fb3a493ca6b202641b9252d8b39b753af23 Mon Sep 17 00:00:00 2001 From: v81d Date: Mon, 16 Feb 2026 23:42:56 -0500 Subject: [PATCH 3/5] feat: add functionality to hide trivial devices --- src/utils/device-manager.vala | 22 ++++++++++++++++++++++ src/window.vala | 18 +++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/utils/device-manager.vala b/src/utils/device-manager.vala index 019db99..0ba429c 100644 --- a/src/utils/device-manager.vala +++ b/src/utils/device-manager.vala @@ -61,6 +61,28 @@ namespace DeviceManager { public string? health_description { get; set; } public DeviceObject () {} + + public bool is_trivial () { + return vendor == null && + model == null && + serial == null && + technology == null && + state == null && + energy == null && + energy_full == null && + energy_full_design == null && + energy_rate == null && + voltage == null && + voltage_min_design == null && + charge_cycles == null && + charge_start_threshold == null && + charge_end_threshold == null && + time_to_empty == null && + time_to_full == null && + temperature == null && + capacity == null && + health_description == null; + } } // This is the publicly accessible class used to probe, enumerate, and inspect power devices diff --git a/src/window.vala b/src/window.vala index 685b32b..48c64e0 100644 --- a/src/window.vala +++ b/src/window.vala @@ -136,6 +136,7 @@ public class Wattage.Window : Adw.ApplicationWindow { private ArrayList device_info_sections = new ArrayList (); // Preferences and user settings + private bool trivial_devices; private bool auto_refresh; private uint auto_refresh_cooldown; private uint auto_refresh_source_id = 0; @@ -241,6 +242,9 @@ public class Wattage.Window : Adw.ApplicationWindow { private void initialize_gsettings () { this.settings = new Settings ("io.github.v81d.Wattage"); + // Devices + this.trivial_devices = this.settings.get_boolean ("trivial-devices"); + // Automation this.auto_refresh = this.settings.get_boolean ("auto-refresh"); this.auto_refresh_cooldown = this.settings.get_uint ("auto-refresh-cooldown"); @@ -264,6 +268,16 @@ public class Wattage.Window : Adw.ApplicationWindow { stderr.printf ("Could not open preferences dialog: %s\n", e.message); } + // Trivial devices switch + Adw.SwitchRow trivial_devices_switch = this.preferences_dialog_builder.get_object ("trivial_devices_switch") as Adw.SwitchRow; + trivial_devices_switch.set_active (this.trivial_devices); + trivial_devices_switch.notify["active"].connect (() => { + bool is_active = trivial_devices_switch.get_active (); + this.settings.set_boolean ("trivial-devices", is_active); + this.trivial_devices = is_active; + load_device_list (); + }); + // Auto-refresh switch Adw.SwitchRow auto_refresh_switch = this.preferences_dialog_builder.get_object ("auto_refresh_switch") as Adw.SwitchRow; auto_refresh_switch.set_active (this.auto_refresh); @@ -472,8 +486,10 @@ public class Wattage.Window : Adw.ApplicationWindow { Idle.add (() => { if (generation != this.load_device_list_generation)return false; - foreach (DeviceObject device in devices) + foreach (DeviceObject device in devices) { + if (!this.trivial_devices && device.is_trivial ())continue; this.append_device (device); + } if (this.device_list.get_row_at_index (this.selected_device_index) != null) this.device_list.select_row (this.device_list.get_row_at_index (this.selected_device_index)); From a938feb4ec48115e23d7d08eac00bc0606dc5da2 Mon Sep 17 00:00:00 2001 From: v81d Date: Mon, 16 Feb 2026 23:46:53 -0500 Subject: [PATCH 4/5] feat: simplify status page texts --- src/ui/window.blp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/window.blp b/src/ui/window.blp index cc511c9..483ddc7 100644 --- a/src/ui/window.blp +++ b/src/ui/window.blp @@ -38,7 +38,7 @@ template $WattageWindow: Adw.ApplicationWindow { [overlay] Adw.StatusPage device_list_empty_status { title: _("No Devices Found"); - description: _("Please check your UPower connection."); + description: _("Check your UPower connection"); icon-name: "battery-missing-symbolic"; visible: false; } @@ -102,8 +102,8 @@ template $WattageWindow: Adw.ApplicationWindow { Adw.StatusPage device_info_empty_status { hexpand: true; vexpand: true; - title: _("No Device Information"); - description: _("Load a valid device to view its information."); + title: _("No Device Details"); + description: _("Load a device to view its information"); icon-name: "info-outline-symbolic"; visible: false; } From 2ea3b7aadc96ae648098e86ccf0cce37950ab25e Mon Sep 17 00:00:00 2001 From: v81d Date: Mon, 16 Feb 2026 23:50:25 -0500 Subject: [PATCH 5/5] feat: make technology strings more accurate --- src/utils/device-manager.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/device-manager.vala b/src/utils/device-manager.vala index 0ba429c..aceb2c9 100644 --- a/src/utils/device-manager.vala +++ b/src/utils/device-manager.vala @@ -129,12 +129,12 @@ namespace DeviceManager { if (device_technology == null)return null; switch (device_technology) { - case 1: return _("Lithium ion"); - case 2: return _("Lithium polymer"); + case 1: return _("Lithium-ion"); + case 2: return _("Lithium-ion polymer"); case 3: return _("Lithium iron phosphate"); - case 4: return _("Lead acid"); - case 5: return _("Nickel cadmium"); - case 6: return _("Nickel metal hydride"); + case 4: return _("Lead-acid"); + case 5: return _("Nickel-cadmium"); + case 6: return _("Nickel-metal hydride"); default: return null; } }