mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
[enhancement]: Start minimized (#522)
* [enhancement]: support starting minimized * show window when dock clicked macos
This commit is contained in:
parent
77fa723cf8
commit
5caf0d439f
4 changed files with 39 additions and 5 deletions
|
|
@ -206,7 +206,7 @@ const createTray = () => {
|
|||
tray.setContextMenu(contextMenu);
|
||||
};
|
||||
|
||||
const createWindow = async () => {
|
||||
const createWindow = async (first = true) => {
|
||||
if (isDevelopment) {
|
||||
await installExtensions();
|
||||
}
|
||||
|
|
@ -350,13 +350,14 @@ const createWindow = async () => {
|
|||
|
||||
mainWindow.loadURL(resolveHtmlPath('index.html'));
|
||||
|
||||
const startWindowMinimized = store.get('window_start_minimized', false) as boolean;
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
if (!mainWindow) {
|
||||
throw new Error('"mainWindow" is not defined');
|
||||
}
|
||||
if (process.env.START_MINIMIZED) {
|
||||
mainWindow.minimize();
|
||||
} else {
|
||||
|
||||
if (!first || !startWindowMinimized) {
|
||||
mainWindow.show();
|
||||
createWinThumbarButtons();
|
||||
}
|
||||
|
|
@ -608,7 +609,11 @@ if (!singleInstance) {
|
|||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow === null) createWindow();
|
||||
if (mainWindow === null) createWindow(false);
|
||||
else if (!mainWindow.isVisible()) {
|
||||
mainWindow.show();
|
||||
createWinThumbarButtons();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(console.log);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue