on mac dock icon click show available window
This commit is contained in:
parent
8cab5280d2
commit
b973096392
|
@ -3,7 +3,6 @@ import path from 'path';
|
||||||
import { existsSync } from 'promise-fs';
|
import { existsSync } from 'promise-fs';
|
||||||
import appUpdater from './appUpdater';
|
import appUpdater from './appUpdater';
|
||||||
import { isDev } from './common';
|
import { isDev } from './common';
|
||||||
import { createWindow } from './createWindow';
|
|
||||||
import { buildContextMenu, buildMenuBar } from './menu';
|
import { buildContextMenu, buildMenuBar } from './menu';
|
||||||
|
|
||||||
export function handleUpdates(mainWindow: BrowserWindow, tray: Tray) {
|
export function handleUpdates(mainWindow: BrowserWindow, tray: Tray) {
|
||||||
|
@ -53,9 +52,9 @@ export function getUniqueSavePath(filename: string, directory: string): string {
|
||||||
|
|
||||||
export function setupMacWindowOnDockIconClick() {
|
export function setupMacWindowOnDockIconClick() {
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
const windows = BrowserWindow.getAllWindows();
|
||||||
// dock icon is clicked and there are no other windows open.
|
// we allow only one window
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
windows[0].show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue