mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-15 13:55:51 -07:00
fix(overlay): handle X11 display scaling across monitors (#193)
This commit is contained in:
+19
-16
@@ -1,5 +1,4 @@
|
||||
import os from 'node:os';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { app, dialog, shell } from 'electron';
|
||||
import { printHelp } from './cli/help';
|
||||
import {
|
||||
@@ -20,9 +19,9 @@ import {
|
||||
shouldHandleHelpOnlyAtEntry,
|
||||
shouldHandleLaunchMpvAtEntry,
|
||||
shouldHandleStatsDaemonCommandAtEntry,
|
||||
spawnDetachedApp,
|
||||
} from './main-entry-runtime';
|
||||
import { requestSingleInstanceLockEarly } from './main/early-single-instance';
|
||||
import { resolveAppImageMountKeepaliveInvocation } from './main/appimage-mount-keepalive';
|
||||
import { readConfiguredWindowsMpvLaunch } from './main-entry-launch-config';
|
||||
import { isAppControlServerAvailable, sendAppControlCommand } from './shared/app-control-client';
|
||||
import {
|
||||
@@ -44,6 +43,10 @@ import {
|
||||
resolveDefaultLogFilePath,
|
||||
type LogRotation,
|
||||
} from './shared/log-files';
|
||||
import {
|
||||
resolveX11ElectronRelaunchArgs,
|
||||
X11_ELECTRON_BOOTSTRAP_ENV,
|
||||
} from './core/utils/electron-backend';
|
||||
|
||||
const DEFAULT_TEXTHOOKER_PORT = 5174;
|
||||
|
||||
@@ -296,26 +299,26 @@ async function runEntryProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const childArgs = hasTransportedStartupArgs(process.env) ? [] : process.argv.slice(1);
|
||||
const x11ChildArgs = resolveX11ElectronRelaunchArgs(childArgs, process.env);
|
||||
|
||||
if (shouldDetachBackgroundLaunch(process.argv, process.env)) {
|
||||
const childArgs = hasTransportedStartupArgs(process.env) ? [] : process.argv.slice(1);
|
||||
const keepalive = resolveAppImageMountKeepaliveInvocation(process.env);
|
||||
const child = keepalive
|
||||
? spawn(keepalive.command, [...keepalive.args, ...childArgs], {
|
||||
detached: true,
|
||||
stdio: 'ignore',
|
||||
env: sanitizeBackgroundEnv(process.env),
|
||||
})
|
||||
: spawn(process.execPath, childArgs, {
|
||||
detached: true,
|
||||
stdio: 'ignore',
|
||||
env: sanitizeBackgroundEnv(process.env),
|
||||
});
|
||||
child.unref();
|
||||
const childEnv = sanitizeBackgroundEnv(process.env);
|
||||
if (x11ChildArgs) childEnv[X11_ELECTRON_BOOTSTRAP_ENV] = '1';
|
||||
spawnDetachedApp(x11ChildArgs ?? childArgs, childEnv);
|
||||
// Let Electron stop bootstrap Chromium children before its AppImage mount is released.
|
||||
exitBackgroundBootstrap(app);
|
||||
return;
|
||||
}
|
||||
|
||||
if (x11ChildArgs) {
|
||||
const childEnv = sanitizeStartupEnv(process.env);
|
||||
childEnv[X11_ELECTRON_BOOTSTRAP_ENV] = '1';
|
||||
spawnDetachedApp(x11ChildArgs, childEnv);
|
||||
exitBackgroundBootstrap(app);
|
||||
return;
|
||||
}
|
||||
|
||||
startMainProcess();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user