diff --git a/default-plugins/configuration/src/main.rs b/default-plugins/configuration/src/main.rs index 016dca5828..67c7577be5 100644 --- a/default-plugins/configuration/src/main.rs +++ b/default-plugins/configuration/src/main.rs @@ -32,8 +32,16 @@ impl Screen { Screen::new_reset_keybindings_screen(Some(0)); } else { match self { - Screen::RebindLeaders(r) => *r = Default::default(), - Screen::Presets(r) => *r = Default::default(), + Screen::RebindLeaders(r) => { + let notification = r.drain_notification(); + *r = Default::default(); + r.set_notification(notification); + }, + Screen::Presets(r) => { + let notification = r.drain_notification(); + *r = Default::default(); + r.set_notification(notification); + }, } } } diff --git a/default-plugins/configuration/src/presets_screen.rs b/default-plugins/configuration/src/presets_screen.rs index af76c36a12..0551c89536 100644 --- a/default-plugins/configuration/src/presets_screen.rs +++ b/default-plugins/configuration/src/presets_screen.rs @@ -190,6 +190,12 @@ impl PresetsScreen { pub fn reset_selected_index(&mut self) { self.selected_index = Some(0); } + pub fn drain_notification(&mut self) -> Option { + self.notification.take() + } + pub fn set_notification(&mut self, notification: Option) { + self.notification = notification; + } fn reconfigure(&self, selected: usize, write_to_disk: bool) { if selected == 0 { // TODO: these should be part of a "transaction" when they are diff --git a/default-plugins/configuration/src/rebind_leaders_screen.rs b/default-plugins/configuration/src/rebind_leaders_screen.rs index e745cf9815..747175ab7a 100644 --- a/default-plugins/configuration/src/rebind_leaders_screen.rs +++ b/default-plugins/configuration/src/rebind_leaders_screen.rs @@ -680,6 +680,12 @@ impl RebindLeadersScreen { self.handle_default_preset_key(key) } } + pub fn drain_notification(&mut self) -> Option { + self.notification.take() + } + pub fn set_notification(&mut self, notification: Option) { + self.notification = notification; + } fn currently_in_unlock_first(&self) -> bool { if self.is_rebinding_for_presets { false