mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 22:52:19 +03:00
Merged — locally validated (6/6 focused lazy-window tests, plus the wider electron suite, typecheck:core clean, gates green). Thanks!
29 lines
722 B
JavaScript
29 lines
722 B
JavaScript
/** Pure helpers for deciding and driving the Electron dashboard window lifecycle. */
|
|
|
|
function shouldStartHidden({ argv = [], loginItemSettings = {} } = {}) {
|
|
return (
|
|
argv.includes("--hidden") ||
|
|
argv.includes("--minimized") ||
|
|
loginItemSettings.wasOpenedAsHidden === true
|
|
);
|
|
}
|
|
|
|
function showOrCreateWindow({ appReady, getWindow, createWindow }) {
|
|
if (!appReady) return null;
|
|
|
|
const currentWindow = getWindow();
|
|
if (!currentWindow || currentWindow.isDestroyed()) {
|
|
return createWindow();
|
|
}
|
|
|
|
if (currentWindow.isMinimized()) currentWindow.restore();
|
|
currentWindow.show();
|
|
currentWindow.focus();
|
|
return currentWindow;
|
|
}
|
|
|
|
module.exports = {
|
|
shouldStartHidden,
|
|
showOrCreateWindow,
|
|
};
|