Add function to remove all global shortcuts.

This commit is contained in:
Nolan Darilek committed 2023-03-09 11:05:41 -06:00
1 parent 6a16df835d
commit 8657b47401
2 files changed
+17

No files matched your search

+12
View File
@@ -113,6 +113,18 @@ impl ShortcutRegistry {
}
}
}
pub(crate) fn remove_all(&self) {
let mut shortcuts = self.shortcuts.borrow_mut();
shortcuts.clear();
let _ = self.manager.borrow_mut().unregister_all();
// prevent CTRL+R from reloading the page which breaks apps
let _ = self.add_shortcut(
Some(ModifiersState::CONTROL),
KeyCode::KeyR,
Box::new(|| {}),
);
}
}
#[non_exhaustive]