diff --git a/CHANGELOG.md b/CHANGELOG.md index a0ab5435..9054719c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Move FX506HC to FX506H in arua DB to catch full series of this range - Move FX506LH to FX506L in arua DB to catch full series of this range - Support for GV601VI LED modes - +- Rmeove notification handle tracking limit, fixes KDE issue with profile notif ## [v4.6.2] - Fix rog-control-center not reopening if `startup_in_background` is set diff --git a/daemon/src/ctrl_aura/controller.rs b/daemon/src/ctrl_aura/controller.rs index 43be85c4..811948f7 100644 --- a/daemon/src/ctrl_aura/controller.rs +++ b/daemon/src/ctrl_aura/controller.rs @@ -225,7 +225,11 @@ impl CtrlKbdLed { self.write_mode(&effect)?; self.config.read(); // refresh config if successful self.config.set_builtin(effect); + if self.config.brightness == LedBrightness::Off { + self.config.brightness = LedBrightness::Med; + } self.config.write(); + self.set_brightness(self.config.brightness)?; Ok(()) } @@ -233,6 +237,11 @@ impl CtrlKbdLed { /// write the raw factory mode packets - when doing this it is expected that /// only the first `Vec` (`effect[0]`) is valid. pub fn write_effect_block(&mut self, effect: &UsbPackets) -> Result<(), RogError> { + if self.config.brightness == LedBrightness::Off { + self.config.brightness = LedBrightness::Med; + self.config.write(); + } + let pkt_type = effect[0][1]; const PER_KEY_TYPE: u8 = 0xbc; diff --git a/rog-control-center/src/update_and_notify.rs b/rog-control-center/src/update_and_notify.rs index 25aebf09..57ff6751 100644 --- a/rog-control-center/src/update_and_notify.rs +++ b/rog-control-center/src/update_and_notify.rs @@ -77,17 +77,6 @@ impl EnabledNotifications { } } -macro_rules! notify { - ($notifier:expr, $last_notif:ident) => { - if let Some(notif) = $last_notif.take() { - notif.close(); - } - if let Ok(x) = $notifier { - $last_notif.replace(x); - } - }; -} - // TODO: drop the macro and use generics plus closure macro_rules! recv_notif { ($proxy:ident, @@ -100,7 +89,6 @@ macro_rules! recv_notif { $msg:literal, $notifier:ident) => { - let last_notif = $last_notif.clone(); let notifs_enabled1 = $notif_enabled.clone(); let page_states1 = $page_states.clone(); @@ -119,10 +107,8 @@ macro_rules! recv_notif { if let Ok(out) = e.args() { if let Ok(config) = notifs_enabled1.lock() { if config.all_enabled && config.$signal { - if let Ok(ref mut lock) = last_notif.lock() { - trace!("zbus signal {} locked last_notif", stringify!($signal)); - notify!($notifier($msg, &out.$($out_arg)+()), lock); - } + trace!("zbus signal {}", stringify!($signal)); + $notifier($msg, &out.$($out_arg)+()).ok(); } } if let Ok(mut lock) = page_states1.lock() { @@ -130,21 +116,18 @@ macro_rules! recv_notif { lock.set_notified(); } } + sleep(Duration::from_millis(500)).await; } }; }); }; } -type SharedHandle = Arc>>; - pub fn start_notifications( config: &Config, page_states: &Arc>, enabled_notifications: &Arc>, ) -> Result<()> { - let last_notification: SharedHandle = Arc::new(Mutex::new(None)); - // Setup the AC/BAT commands that will run on poweer status change unsafe { let prog: Vec<&str> = config.ac_command.split_whitespace().collect(); @@ -299,7 +282,6 @@ pub fn start_notifications( }); let page_states1 = page_states.clone(); - let last_notification1 = last_notification.clone(); tokio::spawn(async move { let conn = zbus::Connection::system() .await @@ -332,11 +314,6 @@ pub fn start_notifications( lock.bios.dedicated_gfx = out.mode; lock.set_notified(); } - if let Ok(ref mut lock) = last_notification1.lock() { - if let Some(notif) = lock.take() { - notif.close(); - } - } do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &out.mode) .ok(); } @@ -351,7 +328,6 @@ pub fn start_notifications( for dev in dev { if dev.is_dgpu() { let notifs_enabled1 = enabled_notifications.clone(); - let last_notif = last_notification.clone(); let page_states1 = page_states.clone(); // Plain old thread is perfectly fine since most of this is potentially blocking tokio::spawn(async move { @@ -363,15 +339,7 @@ pub fn start_notifications( if config.all_enabled && config.receive_notify_gfx_status { // Required check because status cycles through // active/unknown/suspended - if let Ok(ref mut lock) = last_notif.lock() { - notify!( - do_gpu_status_notif( - "dGPU status changed:", - &status - ), - lock - ); - } + do_gpu_status_notif("dGPU status changed:", &status).ok(); } } if let Ok(mut lock) = page_states1.lock() { @@ -478,7 +446,7 @@ where notif .summary(NOTIF_HEADER) .body(&format!("{message} {data}")) - .timeout(2000) + .timeout(-1) //.hint(Hint::Resident(true)) .hint(Hint::Category("device".into())); @@ -554,7 +522,7 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R //.hint(Hint::Resident(true)) .hint(Hint::Category("device".into())) .urgency(Urgency::Critical) - .timeout(3000) + .timeout(-1) .icon("dialog-warning") .hint(Hint::Transient(true));