mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 11:06:25 +08:00
feat(electron): more desktop app related shortcuts (#9724)
fix AF-2126, AF-2124 - Add CMD+M for minimize the app. - Enhance how CMD+W works. Close the following in order, stop if any one is closed: - peek view - split view - tab - otherwise, hide the app
This commit is contained in:
@@ -42,4 +42,10 @@ export const uiEvents = {
|
||||
sub.unsubscribe();
|
||||
};
|
||||
},
|
||||
onCloseView: (fn: () => void) => {
|
||||
const sub = uiSubjects.onCloseView$.subscribe(fn);
|
||||
return () => {
|
||||
sub.unsubscribe();
|
||||
};
|
||||
},
|
||||
} satisfies Record<string, MainEventRegister>;
|
||||
|
||||
@@ -71,6 +71,10 @@ export const uiHandlers = {
|
||||
handleCloseApp: async () => {
|
||||
app.quit();
|
||||
},
|
||||
handleHideApp: async () => {
|
||||
const window = await getMainWindow();
|
||||
window?.hide();
|
||||
},
|
||||
handleNetworkChange: async (_, _isOnline: boolean) => {
|
||||
isOnline = _isOnline;
|
||||
},
|
||||
@@ -191,6 +195,7 @@ export const uiHandlers = {
|
||||
closeTab: async (_, ...args: Parameters<typeof closeTab>) => {
|
||||
await closeTab(...args);
|
||||
},
|
||||
|
||||
activateView: async (_, ...args: Parameters<typeof activateView>) => {
|
||||
await activateView(...args);
|
||||
},
|
||||
|
||||
@@ -7,4 +7,6 @@ export const uiSubjects = {
|
||||
onFullScreen$: new Subject<boolean>(),
|
||||
onToggleRightSidebar$: new Subject<string>(),
|
||||
authenticationRequest$: new Subject<AuthenticationRequest>(),
|
||||
// via menu -> close view (CMD+W)
|
||||
onCloseView$: new Subject<void>(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user