hide dock icon on autoLaunch
This commit is contained in:
parent
c978eb9cf2
commit
7a56ca59c6
|
@ -1,3 +1,4 @@
|
|||
import { handleDockIconHideOnAutoLaunch } from './utils/main';
|
||||
import { app, BrowserWindow } from 'electron';
|
||||
import { createWindow } from './utils/createWindow';
|
||||
import setupIpcComs from './utils/ipcComms';
|
||||
|
@ -42,6 +43,7 @@ const gotTheLock = app.requestSingleInstanceLock();
|
|||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
handleDockIconHideOnAutoLaunch();
|
||||
app.commandLine.appendSwitch('enable-features', 'SharedArrayBuffer');
|
||||
app.on('second-instance', () => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
|
|
|
@ -7,6 +7,8 @@ import { existsSync } from 'promise-fs';
|
|||
import appUpdater from './appUpdater';
|
||||
import { isDev } from './common';
|
||||
import { buildContextMenu, buildMenuBar } from './menu';
|
||||
import autoLauncher from '../services/autoLauncher';
|
||||
import { getHideDockIconPreference } from '../services/userPreference';
|
||||
|
||||
export function handleUpdates(mainWindow: BrowserWindow, tray: Tray) {
|
||||
if (!isDev) {
|
||||
|
@ -84,3 +86,12 @@ export function isPlatformMac() {
|
|||
export function isPlatformWindows() {
|
||||
return process.platform === 'win32';
|
||||
}
|
||||
|
||||
export async function handleDockIconHideOnAutoLaunch() {
|
||||
const shouldHideDockIcon = getHideDockIconPreference();
|
||||
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
|
||||
|
||||
if (isPlatformMac() && shouldHideDockIcon && wasAutoLaunched) {
|
||||
app.dock.hide();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue