diff --git a/Cargo.lock b/Cargo.lock index 79dab522..021d6061 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1324,7 +1324,7 @@ dependencies = [ [[package]] name = "cosmic-settings-subscriptions" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-settings-subscriptions#21cc79434fa24f1fbd6dc4e8d394aa51d5ee12d9" +source = "git+https://github.com/pop-os/cosmic-settings-subscriptions#c19240ad2c9f11ef5cec8ed8c70255c3dc9ae8d4" dependencies = [ "futures", "iced_futures", @@ -1511,7 +1511,7 @@ version = "0.19.0" source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" dependencies = [ "bitflags 2.5.0", - "libloading 0.8.3", + "libloading 0.7.4", "winapi", ] @@ -1774,7 +1774,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.3", + "libloading 0.7.4", ] [[package]] @@ -2608,7 +2608,7 @@ dependencies = [ "bitflags 2.5.0", "com", "libc", - "libloading 0.8.3", + "libloading 0.7.4", "thiserror", "widestring", "winapi", @@ -6537,7 +6537,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.3", + "libloading 0.7.4", "log", "metal", "naga", diff --git a/cosmic-applet-battery/src/app.rs b/cosmic-applet-battery/src/app.rs index 1fa19dde..18879e9a 100644 --- a/cosmic-applet-battery/src/app.rs +++ b/cosmic-applet-battery/src/app.rs @@ -156,15 +156,11 @@ impl CosmicBatteryApplet { enum Message { TogglePopup, CloseRequested(window::Id), - Update { - on_battery: bool, - percent: f64, - time_to_empty: i64, - }, SetKbdBrightness(i32), SetScreenBrightness(i32), SetChargingLimit(chain::Toggler, bool), KeyboardBacklight(KeyboardBacklightUpdate), + UpowerDevice(DeviceDbusEvent), GpuOn(PathBuf, String, Option>), GpuOff(PathBuf), ToggleGpuApps(PathBuf), @@ -273,14 +269,19 @@ impl cosmic::Application for CosmicBatteryApplet { return get_popup(popup_settings); } } - Message::Update { - on_battery, - percent, - time_to_empty, - } => { - self.update_battery(percent, on_battery); - self.time_remaining = Duration::from_secs(time_to_empty as u64); - } + Message::UpowerDevice(event) => match event { + DeviceDbusEvent::Update { + on_battery, + percent, + time_to_empty, + } => { + self.update_battery(percent, on_battery); + self.time_remaining = Duration::from_secs(time_to_empty as u64); + } + DeviceDbusEvent::NoBattery => { + std::process::exit(0); + } + }, Message::KeyboardBacklight(event) => match event { KeyboardBacklightUpdate::Sender(tx) => { self.kbd_sender = Some(tx); @@ -682,17 +683,7 @@ impl cosmic::Application for CosmicBatteryApplet { fn subscription(&self) -> Subscription { let mut subscriptions = vec![ - device_subscription(0).map( - |DeviceDbusEvent::Update { - on_battery, - percent, - time_to_empty, - }| Message::Update { - on_battery, - percent, - time_to_empty, - }, - ), + device_subscription(0).map(Message::UpowerDevice), kbd_backlight_subscription(0).map(Message::KeyboardBacklight), power_profile_subscription(0).map(|event| match event { PowerProfileUpdate::Update { profile } => Message::Profile(profile),