diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffe01d0..f4b56d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Notify through dbus if user changes profile manually # [3.1.3] - 2021-03-10 ### Changed diff --git a/daemon/src/ctrl_fan_cpu.rs b/daemon/src/ctrl_fan_cpu.rs index a8a221a1..d43f2703 100644 --- a/daemon/src/ctrl_fan_cpu.rs +++ b/daemon/src/ctrl_fan_cpu.rs @@ -62,7 +62,12 @@ impl DbusFanAndCpu { cfg.read(); ctrl.handle_profile_event(&event, &mut cfg) .unwrap_or_else(|err| warn!("{}", err)); - self.notify_profile(&cfg.active_profile).unwrap_or(()); + if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) { + if let Ok(json) = serde_json::to_string(profile) { + self.notify_profile(&json) + .unwrap_or_else(|err| warn!("{}", err)); + } + } } } } @@ -72,6 +77,7 @@ impl DbusFanAndCpu { fn next_profile(&mut self) { if let Ok(mut ctrl) = self.inner.try_lock() { if let Ok(mut cfg) = ctrl.config.clone().try_lock() { + cfg.read(); ctrl.do_next_profile(&mut cfg) .unwrap_or_else(|err| warn!("{}", err)); if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) {