feat: Hide to tray on game startup and ability to disable trailers auto-play

This commit is contained in:
Moyasee
2025-10-28 17:34:20 +02:00
parent 61072aa02a
commit 120aad6c1c
5 changed files with 49 additions and 3 deletions

View File

@@ -4,7 +4,8 @@ import type { Game, GameRunning } from "@types";
import { PythonRPC } from "./python-rpc";
import axios from "axios";
import { ProcessPayload } from "./download/types";
import { gamesSublevel, levelKeys } from "@main/level";
import { db, gamesSublevel, levelKeys } from "@main/level";
import type { UserPreferences } from "@types";
import { CloudSync } from "./cloud-sync";
import { logger } from "./logger";
import path from "path";
@@ -209,6 +210,18 @@ function onOpenGame(game: Game) {
lastSyncTick: now,
});
// Hide Hydra to tray on game startup if enabled
db
.get<string, UserPreferences | null>(levelKeys.userPreferences, {
valueEncoding: "json",
})
.then((userPreferences) => {
if (userPreferences?.hideToTrayOnGameStart) {
WindowManager.mainWindow?.hide();
}
})
.catch(() => {});
if (game.remoteId) {
updateGamePlaytime(
game,