From 5944745da6cd93e3ab92dcd1a42f2aee46e42c46 Mon Sep 17 00:00:00 2001 From: Nathan Smith Date: Wed, 8 May 2024 00:24:33 +1000 Subject: [PATCH] Resolves ksni issues in Ubuntu & adding additional menu for battery status --- src/battery_tray.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/battery_tray.rs b/src/battery_tray.rs index b8e5ef5..13eb1b0 100644 --- a/src/battery_tray.rs +++ b/src/battery_tray.rs @@ -66,10 +66,18 @@ impl BatteryTray { impl Tray for BatteryTray { fn icon_name(&self) -> String { - "headset".into() + "audio-headset".into() + } + fn id(&self) -> String { + env!("CARGO_PKG_NAME").into() } fn menu(&self) -> Vec> { vec![ + StandardItem { + label: format!("Battery level: {bat}% ({crg})", bat = self.battery_level,crg = (if self.charging.is_some() { "Charging" } else {"Discharging"})).into(), + ..Default::default() + } + .into(), StandardItem { label: "Exit".into(), icon_name: "application-exit".into(), @@ -111,8 +119,8 @@ impl Tray for BatteryTray { ToolTip { title: "HyperX Cloud II".to_string(), description: description, - icon_name: "".into(), + icon_name: "audio-headset".into(), icon_pixmap: Vec::new(), } } -} \ No newline at end of file +}