mirror of
https://github.com/jeffvli/feishin.git
synced 2026-08-08 05:12:57 +02:00
Add a Window menu item that re-opens main window on Mac (#2269)
* Add a Window menu item that re-opens main window on Mac * only rebuild menu on macos
This commit is contained in:
@@ -772,6 +772,16 @@ async function createWindow(first = true): Promise<void> {
|
|||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isMacOS()) {
|
||||||
|
mainWindow.on('show', () => {
|
||||||
|
rebuildMainMenu();
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.on('hide', () => {
|
||||||
|
rebuildMainMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mainWindow.on('close', (event) => {
|
mainWindow.on('close', (event) => {
|
||||||
store.set('bounds', mainWindow?.getNormalBounds());
|
store.set('bounds', mainWindow?.getNormalBounds());
|
||||||
store.set('maximized', mainWindow?.isMaximized());
|
store.set('maximized', mainWindow?.isMaximized());
|
||||||
|
|||||||
+19
-1
@@ -2,6 +2,7 @@ import { BrowserWindow, Menu, MenuItemConstructorOptions, shell } from 'electron
|
|||||||
|
|
||||||
import packageJson from '../../package.json';
|
import packageJson from '../../package.json';
|
||||||
|
|
||||||
|
import { store } from '/@/main/features/core/settings';
|
||||||
import { PlayerRepeat, PlayerStatus } from '/@/shared/types/types';
|
import { PlayerRepeat, PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
export type MenuPlaybackState = {
|
export type MenuPlaybackState = {
|
||||||
@@ -173,7 +174,24 @@ export default class MenuBuilder {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const subMenuWindow: MenuItemConstructorOptions = { role: 'windowMenu' };
|
const subMenuWindow: MenuItemConstructorOptions = {
|
||||||
|
role: 'windowMenu',
|
||||||
|
submenu:
|
||||||
|
store.get('window_exit_to_tray') && !this.mainWindow.isVisible()
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
type: 'separator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accelerator: 'CmdOrCtrl+0',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.show();
|
||||||
|
},
|
||||||
|
label: 'Feishin',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: undefined,
|
||||||
|
};
|
||||||
const subMenuPlayback: MenuItemConstructorOptions = {
|
const subMenuPlayback: MenuItemConstructorOptions = {
|
||||||
label: 'Playback',
|
label: 'Playback',
|
||||||
submenu: [
|
submenu: [
|
||||||
|
|||||||
Reference in New Issue
Block a user