mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
- Stats server auto-start on immersion tracker init - Stats overlay toggle via keybinding and IPC - Stats CLI command (subminer stats) with cleanup mode - mpv plugin menu integration for stats toggle - CLI args for --stats, --stats-cleanup, --stats-response-path
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import type { CliArgs } from '../../cli/args';
|
|
|
|
type MpvClientLike = {
|
|
connected: boolean;
|
|
connect: () => void;
|
|
};
|
|
|
|
export function createHandleInitialArgsHandler(deps: {
|
|
getInitialArgs: () => CliArgs | null;
|
|
isBackgroundMode: () => boolean;
|
|
shouldEnsureTrayOnStartup: () => boolean;
|
|
ensureTray: () => void;
|
|
isTexthookerOnlyMode: () => boolean;
|
|
hasImmersionTracker: () => boolean;
|
|
getMpvClient: () => MpvClientLike | null;
|
|
logInfo: (message: string) => void;
|
|
handleCliCommand: (args: CliArgs, source: 'initial') => void;
|
|
}) {
|
|
return (): void => {
|
|
const initialArgs = deps.getInitialArgs();
|
|
if (!initialArgs) return;
|
|
|
|
if (deps.isBackgroundMode() || deps.shouldEnsureTrayOnStartup()) {
|
|
deps.ensureTray();
|
|
}
|
|
|
|
const mpvClient = deps.getMpvClient();
|
|
if (
|
|
!deps.isTexthookerOnlyMode() &&
|
|
!initialArgs.stats &&
|
|
deps.hasImmersionTracker() &&
|
|
mpvClient &&
|
|
!mpvClient.connected
|
|
) {
|
|
deps.logInfo('Auto-connecting MPV client for immersion tracking');
|
|
mpvClient.connect();
|
|
}
|
|
|
|
deps.handleCliCommand(initialArgs, 'initial');
|
|
};
|
|
}
|