mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00: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:
@@ -2,10 +2,10 @@ import { app, Menu } from 'electron';
|
||||
|
||||
import { isMacOS } from '../../shared/utils';
|
||||
import { logger, revealLogFile } from '../logger';
|
||||
import { uiSubjects } from '../ui/subject';
|
||||
import { checkForUpdates } from '../updater';
|
||||
import {
|
||||
addTab,
|
||||
closeTab,
|
||||
initAndShowMainWindow,
|
||||
reloadView,
|
||||
showDevTools,
|
||||
@@ -103,6 +103,9 @@ export function createApplicationMenu() {
|
||||
reloadView().catch(console.error);
|
||||
},
|
||||
},
|
||||
{
|
||||
role: 'windowMenu',
|
||||
},
|
||||
{
|
||||
label: 'Open devtools',
|
||||
accelerator: isMac ? 'Cmd+Option+I' : 'Ctrl+Shift+I',
|
||||
@@ -129,11 +132,12 @@ export function createApplicationMenu() {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Close tab',
|
||||
label: 'Close view',
|
||||
accelerator: 'CommandOrControl+W',
|
||||
click() {
|
||||
logger.info('Close tab with shortcut');
|
||||
closeTab().catch(console.error);
|
||||
logger.info('Close view with shortcut');
|
||||
// tell the active workbench to close the current view
|
||||
uiSubjects.onCloseView$.next();
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -195,7 +199,7 @@ export function createApplicationMenu() {
|
||||
{
|
||||
label: 'Learn More',
|
||||
click: async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
// oxlint-disable-next-line
|
||||
const { shell } = require('electron');
|
||||
await shell.openExternal('https://affine.pro/');
|
||||
},
|
||||
@@ -216,7 +220,7 @@ export function createApplicationMenu() {
|
||||
{
|
||||
label: 'Documentation',
|
||||
click: async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
// oxlint-disable-next-line
|
||||
const { shell } = require('electron');
|
||||
await shell.openExternal(
|
||||
'https://docs.affine.pro/docs/hello-bonjour-aloha-你好'
|
||||
|
||||
Reference in New Issue
Block a user