mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
CI verde: 18 checks passando (4 shards de unit, Vitest, CodeQL, Fast Quality Gates, No new ESLint warnings, semgrep). Local: 8/8 no teste atualizado e 165/165 nos 16 arquivos tests/unit/electron-*.test.ts.
29 lines
933 B
JavaScript
29 lines
933 B
JavaScript
/** Pure helpers for deciding and driving the Electron dashboard window lifecycle. */
|
|
|
|
// Electron 44 removed `openAsHidden`/`wasOpenedAsHidden` from
|
|
// `app.set/getLoginItemSettings()` (they only ever worked on macOS 12 and below, which
|
|
// Electron 44 no longer supports). The hidden-autostart contract is now carried solely by
|
|
// the `--hidden` argument registered with the login item.
|
|
function shouldStartHidden({ argv = [] } = {}) {
|
|
return argv.includes("--hidden") || argv.includes("--minimized");
|
|
}
|
|
|
|
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,
|
|
};
|