This commit is contained in:
Ian Douglas Scott 2024-10-25 15:39:05 -07:00
parent 9db7e52704
commit 163356f012

View file

@ -193,11 +193,10 @@ impl State {
fn recreate_notification(&mut self) { fn recreate_notification(&mut self) {
if self.screen_off_idle_notification.as_ref().map(|x| x.time) != self.conf.screen_off_time { if self.screen_off_idle_notification.as_ref().map(|x| x.time) != self.conf.screen_off_time {
self.screen_off_idle_notification = if let Some(time) = self.conf.screen_off_time { self.screen_off_idle_notification = self
Some(IdleNotification::new(&self.inner, time)) .conf
} else { .screen_off_time
None .map(|time| IdleNotification::new(&self.inner, time));
};
self.update_screen_off_idle(false); self.update_screen_off_idle(false);
} }
let suspend_time = if self.on_battery { let suspend_time = if self.on_battery {
@ -206,11 +205,8 @@ impl State {
self.conf.suspend_on_ac_time self.conf.suspend_on_ac_time
}; };
if self.suspend_idle_notification.as_ref().map(|x| x.time) != suspend_time { if self.suspend_idle_notification.as_ref().map(|x| x.time) != suspend_time {
self.suspend_idle_notification = if let Some(time) = suspend_time { self.suspend_idle_notification =
Some(IdleNotification::new(&self.inner, time)) suspend_time.map(|time| IdleNotification::new(&self.inner, time));
} else {
None
};
self.update_suspend_idle(false); self.update_suspend_idle(false);
} }
} }