mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
1bb7b26641
- Transport Linux AppImage CLI args through SUBMINER_APP_ARGC/ARG_* env vars instead of argv - Add --app-ping command to probe single-instance lock ownership (exit 0 = running, 1 = not) - Gate manual restart: poll app-ping until old app releases lock, then until new app owns it - Preserve user-paused playback when disarming the auto-play-ready gate on restart - Snapshot subtitles before connection side effects (sub-visibility hide) can suppress them - Reapply overlay bounds after first show for Hyprland compatibility
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import type { BrowserWindowConstructorOptions, Session } from 'electron';
|
|
import * as path from 'path';
|
|
import type { OverlayWindowKind } from './overlay-window-input';
|
|
|
|
export const OVERLAY_WINDOW_TITLES: Record<OverlayWindowKind, string> = {
|
|
visible: 'SubMiner Overlay',
|
|
modal: 'SubMiner Overlay Modal',
|
|
};
|
|
|
|
export function buildOverlayWindowOptions(
|
|
kind: OverlayWindowKind,
|
|
options: {
|
|
isDev: boolean;
|
|
yomitanSession?: Session | null;
|
|
},
|
|
): BrowserWindowConstructorOptions {
|
|
const showNativeDebugFrame = process.platform === 'win32' && options.isDev;
|
|
const shouldStartAlwaysOnTop = !(process.platform === 'win32' && kind === 'visible');
|
|
const shouldAllowCompositorResize = process.platform === 'linux' && kind === 'visible';
|
|
|
|
return {
|
|
show: false,
|
|
title: OVERLAY_WINDOW_TITLES[kind],
|
|
width: 800,
|
|
height: 600,
|
|
x: 0,
|
|
y: 0,
|
|
transparent: true,
|
|
backgroundColor: '#00000000',
|
|
frame: false,
|
|
alwaysOnTop: shouldStartAlwaysOnTop,
|
|
skipTaskbar: true,
|
|
resizable: shouldAllowCompositorResize,
|
|
hasShadow: false,
|
|
focusable: true,
|
|
acceptFirstMouse: true,
|
|
...(process.platform === 'win32' ? { thickFrame: showNativeDebugFrame } : {}),
|
|
webPreferences: {
|
|
preload: path.join(__dirname, '..', '..', 'preload.js'),
|
|
contextIsolation: true,
|
|
nodeIntegration: false,
|
|
sandbox: false,
|
|
backgroundThrottling: false,
|
|
webSecurity: true,
|
|
session: options.yomitanSession ?? undefined,
|
|
additionalArguments: [`--overlay-layer=${kind}`],
|
|
},
|
|
};
|
|
}
|