mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
355d7d95b2
- Launcher detects a running app via control socket and attaches without spawning a new process - Own-lifecycle app launches now pass --background --managed-playback; borrowed apps skip --background - Separate plain subtitle websocket (tokens: []) from annotation websocket - Default pauseVideoOnHover to true; update docs and config.example.jsonc - Setup: remove plugin readiness card, add Open SubMiner Settings button
121 lines
3.8 KiB
TypeScript
121 lines
3.8 KiB
TypeScript
export function createResolveTrayIconPathHandler(deps: {
|
|
resolveTrayIconPathRuntime: (options: {
|
|
platform: string;
|
|
resourcesPath: string;
|
|
appPath: string;
|
|
dirname: string;
|
|
joinPath: (...parts: string[]) => string;
|
|
fileExists: (path: string) => boolean;
|
|
}) => string | null;
|
|
platform: string;
|
|
resourcesPath: string;
|
|
appPath: string;
|
|
dirname: string;
|
|
joinPath: (...parts: string[]) => string;
|
|
fileExists: (path: string) => boolean;
|
|
}) {
|
|
return (): string | null => {
|
|
return deps.resolveTrayIconPathRuntime({
|
|
platform: deps.platform,
|
|
resourcesPath: deps.resourcesPath,
|
|
appPath: deps.appPath,
|
|
dirname: deps.dirname,
|
|
joinPath: deps.joinPath,
|
|
fileExists: deps.fileExists,
|
|
});
|
|
};
|
|
}
|
|
|
|
export function shouldShowTexthookerTrayEntry(config: {
|
|
websocket?: { enabled?: boolean | 'auto' };
|
|
annotationWebsocket?: { enabled?: boolean };
|
|
}): boolean {
|
|
const websocketEnabled = config.websocket?.enabled ?? false;
|
|
const annotationWebsocketEnabled = config.annotationWebsocket?.enabled ?? false;
|
|
return websocketEnabled !== false || annotationWebsocketEnabled !== false;
|
|
}
|
|
|
|
export function createBuildTrayMenuTemplateHandler<TMenuItem>(deps: {
|
|
buildTrayMenuTemplateRuntime: (handlers: {
|
|
openSessionHelp: () => void;
|
|
openTexthookerInBrowser: () => void;
|
|
showTexthookerPage: boolean;
|
|
openFirstRunSetup: () => void;
|
|
showFirstRunSetup: boolean;
|
|
openWindowsMpvLauncherSetup: () => void;
|
|
showWindowsMpvLauncherSetup: boolean;
|
|
openYomitanSettings: () => void;
|
|
openConfigSettings: () => void;
|
|
openJellyfinSetup: () => void;
|
|
showJellyfinDiscovery: boolean;
|
|
jellyfinDiscoveryActive: boolean;
|
|
toggleJellyfinDiscovery: () => void;
|
|
openAnilistSetup: () => void;
|
|
checkForUpdates: () => void;
|
|
quitApp: () => void;
|
|
}) => TMenuItem[];
|
|
initializeOverlayRuntime: () => void;
|
|
isOverlayRuntimeInitialized: () => boolean;
|
|
openSessionHelpModal: () => void;
|
|
openTexthookerInBrowser: () => void;
|
|
showTexthookerPage: () => boolean;
|
|
showFirstRunSetup: () => boolean;
|
|
openFirstRunSetupWindow: () => void;
|
|
showWindowsMpvLauncherSetup: () => boolean;
|
|
openYomitanSettings: () => void;
|
|
openConfigSettingsWindow: () => void;
|
|
openJellyfinSetupWindow: () => void;
|
|
isJellyfinConfigured: () => boolean;
|
|
isJellyfinDiscoveryActive: () => boolean;
|
|
toggleJellyfinDiscovery: () => void | Promise<void>;
|
|
openAnilistSetupWindow: () => void;
|
|
checkForUpdates: () => void;
|
|
quitApp: () => void;
|
|
}) {
|
|
return (): TMenuItem[] => {
|
|
return deps.buildTrayMenuTemplateRuntime({
|
|
openSessionHelp: () => {
|
|
if (!deps.isOverlayRuntimeInitialized()) {
|
|
deps.initializeOverlayRuntime();
|
|
}
|
|
deps.openSessionHelpModal();
|
|
},
|
|
openTexthookerInBrowser: () => {
|
|
deps.openTexthookerInBrowser();
|
|
},
|
|
showTexthookerPage: deps.showTexthookerPage(),
|
|
openFirstRunSetup: () => {
|
|
deps.openFirstRunSetupWindow();
|
|
},
|
|
showFirstRunSetup: deps.showFirstRunSetup(),
|
|
openWindowsMpvLauncherSetup: () => {
|
|
deps.openFirstRunSetupWindow();
|
|
},
|
|
showWindowsMpvLauncherSetup: deps.showWindowsMpvLauncherSetup(),
|
|
openYomitanSettings: () => {
|
|
deps.openYomitanSettings();
|
|
},
|
|
openConfigSettings: () => {
|
|
deps.openConfigSettingsWindow();
|
|
},
|
|
openJellyfinSetup: () => {
|
|
deps.openJellyfinSetupWindow();
|
|
},
|
|
showJellyfinDiscovery: deps.isJellyfinConfigured(),
|
|
jellyfinDiscoveryActive: deps.isJellyfinDiscoveryActive(),
|
|
toggleJellyfinDiscovery: () => {
|
|
void deps.toggleJellyfinDiscovery();
|
|
},
|
|
openAnilistSetup: () => {
|
|
deps.openAnilistSetupWindow();
|
|
},
|
|
checkForUpdates: () => {
|
|
deps.checkForUpdates();
|
|
},
|
|
quitApp: () => {
|
|
deps.quitApp();
|
|
},
|
|
});
|
|
};
|
|
}
|