mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-07-04 17:11:01 -05:00
Use emulated open as hidden for macOS 13
https://github.com/samuelthomas2774/nxapi/issues/154
This commit is contained in:
parent
fbaa188e13
commit
41f6182dc2
|
|
@ -51,10 +51,17 @@ enum LoginItemType {
|
|||
NOT_SUPPORTED,
|
||||
}
|
||||
const login_item_type: LoginItemType =
|
||||
process.platform === 'darwin' ? LoginItemType.NATIVE :
|
||||
process.platform === 'darwin' ?
|
||||
// macOS 13+ does not support open as hidden
|
||||
parseInt(process.getSystemVersion().split('.', 1)[0]) >= 13 ?
|
||||
LoginItemType.NATIVE_PARTIAL : LoginItemType.NATIVE :
|
||||
process.platform === 'win32' ? LoginItemType.NATIVE_PARTIAL :
|
||||
LoginItemType.NOT_SUPPORTED;
|
||||
|
||||
const was_opened_at_login = process.platform === 'darwin' ?
|
||||
app.getLoginItemSettings(login_item_options).wasOpenedAtLogin :
|
||||
process.argv.includes('--app-open-at-login=1');
|
||||
|
||||
debug('Protocol registration options', protocol_registration_options);
|
||||
debug('Login item registration options', LoginItemType[login_item_type], login_item_options);
|
||||
|
||||
|
|
@ -271,7 +278,7 @@ export async function init() {
|
|||
|
||||
const should_hide =
|
||||
login_item_type === LoginItemType.NATIVE ? app.getLoginItemSettings(login_item_options).wasOpenedAsHidden :
|
||||
process.argv.includes('--app-open-at-login=1') && (await appinstance.store.getLoginItem()).startup_hidden;
|
||||
was_opened_at_login && (await appinstance.store.getLoginItem()).startup_hidden;
|
||||
|
||||
if (!should_hide) {
|
||||
appinstance.showMainWindow();
|
||||
|
|
@ -458,7 +465,6 @@ export class Store extends EventEmitter {
|
|||
}
|
||||
|
||||
const startup_options: SavedStartupOptions | undefined = await this.storage.getItem('StartupOptions');
|
||||
const was_opened_at_login = process.argv.includes('--app-open-at-login=1');
|
||||
|
||||
if (login_item_type === LoginItemType.NATIVE_PARTIAL) {
|
||||
// Partial native support
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user