mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-14 08:54:04 +00:00
boilerplate for settings menu item
This commit is contained in:
parent
2cc3f3d95d
commit
51cf523013
|
@ -16,6 +16,13 @@ fn custom_menu_bar() -> Menu {
|
|||
AboutMetadata::new(),
|
||||
)) // TODO: fill out about metadata
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_item(
|
||||
// macOS 13 Ventura automatically changes "Preferences" to "Settings" for system-wide consistency.
|
||||
// Use "Preferences" here to keep consistency on older versions
|
||||
CustomMenuItem::new("open_settings".to_string(), "Preferences...")
|
||||
.accelerator("CmdOrCtrl+Comma"),
|
||||
)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Services)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Hide)
|
||||
|
@ -76,6 +83,9 @@ pub(crate) fn handle_menu_event(event: WindowMenuEvent<Wry>) {
|
|||
"quit" => {
|
||||
std::process::exit(0);
|
||||
}
|
||||
// "open_settings" => {
|
||||
|
||||
// }
|
||||
"close" => {
|
||||
let window = event.window();
|
||||
|
||||
|
|
|
@ -54,12 +54,14 @@ function App() {
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unlistenFocus = listen('tauri://focus', () => setFocused(true));
|
||||
const unlistenBlur = listen('tauri://blur', () => setFocused(false));
|
||||
const focusListener = listen('tauri://focus', () => setFocused(true));
|
||||
const blurListener = listen('tauri://blur', () => setFocused(false));
|
||||
const settingsNavigateListener = listen('navigate_to_settings', () => undefined);
|
||||
|
||||
return () => {
|
||||
unlistenFocus.then((unlisten) => unlisten());
|
||||
unlistenBlur.then((unlisten) => unlisten());
|
||||
focusListener.then((unlisten) => unlisten());
|
||||
blurListener.then((unlisten) => unlisten());
|
||||
settingsNavigateListener.then((unlisten) => unlisten());
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Reference in a new issue