From 120aad6c1cacc2406aad9def4baa63b89d69eef8 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Tue, 28 Oct 2025 17:34:20 +0200 Subject: [PATCH 1/3] feat: Hide to tray on game startup and ability to disable trailers auto-play --- src/locales/en/translation.json | 4 +++- src/main/services/process-watcher.ts | 15 +++++++++++- .../gallery-slider/gallery-slider.tsx | 7 +++++- .../src/pages/settings/settings-behavior.tsx | 24 +++++++++++++++++++ src/types/level.types.ts | 2 ++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 46bdb28c..b17dda80 100755 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -541,7 +541,9 @@ "hidden": "Hidden", "test_notification": "Test notification", "notification_preview": "Achievement Notification Preview", - "enable_friend_start_game_notifications": "When a friend starts playing a game" + "enable_friend_start_game_notifications": "When a friend starts playing a game", + "autoplay_trailers_on_game_page": "Automatically start playing trailers on game page", + "hide_to_tray_on_game_start": "Hide Hydra to tray on game startup" }, "notifications": { "download_complete": "Download complete", diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index 06f5f7d8..9ca40b24 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -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(levelKeys.userPreferences, { + valueEncoding: "json", + }) + .then((userPreferences) => { + if (userPreferences?.hideToTrayOnGameStart) { + WindowManager.mainWindow?.hide(); + } + }) + .catch(() => {}); + if (game.remoteId) { updateGamePlaytime( game, diff --git a/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx b/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx index 4bf8dc48..c9658636 100644 --- a/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx +++ b/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx @@ -7,11 +7,16 @@ import { } from "@primer/octicons-react"; import useEmblaCarousel from "embla-carousel-react"; import { gameDetailsContext } from "@renderer/context"; +import { useAppSelector } from "@renderer/hooks"; import "./gallery-slider.scss"; export function GallerySlider() { const { shopDetails } = useContext(gameDetailsContext); const { t } = useTranslation("game_details"); + const userPreferences = useAppSelector( + (state) => state.userPreferences.value + ); + const autoplayEnabled = userPreferences?.autoplayGameTrailers !== false; const hasScreenshots = shopDetails && shopDetails.screenshots?.length; @@ -164,7 +169,7 @@ export function GallerySlider() { poster={item.poster} loop muted - autoPlay + autoPlay={autoplayEnabled} tabIndex={-1} > diff --git a/src/renderer/src/pages/settings/settings-behavior.tsx b/src/renderer/src/pages/settings/settings-behavior.tsx index 64df52d7..bc91fc9d 100644 --- a/src/renderer/src/pages/settings/settings-behavior.tsx +++ b/src/renderer/src/pages/settings/settings-behavior.tsx @@ -27,6 +27,8 @@ export function SettingsBehavior() { showDownloadSpeedInMegabytes: false, extractFilesByDefault: true, enableSteamAchievements: false, + autoplayGameTrailers: true, + hideToTrayOnGameStart: false, }); const { t } = useTranslation("settings"); @@ -49,6 +51,10 @@ export function SettingsBehavior() { extractFilesByDefault: userPreferences.extractFilesByDefault ?? true, enableSteamAchievements: userPreferences.enableSteamAchievements ?? false, + autoplayGameTrailers: + userPreferences.autoplayGameTrailers ?? true, + hideToTrayOnGameStart: + userPreferences.hideToTrayOnGameStart ?? false, }); } }, [userPreferences]); @@ -76,6 +82,16 @@ export function SettingsBehavior() { } /> + + handleChange({ + hideToTrayOnGameStart: !form.hideToTrayOnGameStart, + }) + } + /> + {showRunAtStartup && ( )} + + handleChange({ autoplayGameTrailers: !form.autoplayGameTrailers }) + } + /> + Date: Tue, 28 Oct 2025 17:36:11 +0200 Subject: [PATCH 2/3] ci: formatting --- src/main/services/process-watcher.ts | 7 +++---- src/renderer/src/pages/settings/settings-behavior.tsx | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index 9ca40b24..4130daba 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -211,10 +211,9 @@ function onOpenGame(game: Game) { }); // Hide Hydra to tray on game startup if enabled - db - .get(levelKeys.userPreferences, { - valueEncoding: "json", - }) + db.get(levelKeys.userPreferences, { + valueEncoding: "json", + }) .then((userPreferences) => { if (userPreferences?.hideToTrayOnGameStart) { WindowManager.mainWindow?.hide(); diff --git a/src/renderer/src/pages/settings/settings-behavior.tsx b/src/renderer/src/pages/settings/settings-behavior.tsx index bc91fc9d..c5698ef7 100644 --- a/src/renderer/src/pages/settings/settings-behavior.tsx +++ b/src/renderer/src/pages/settings/settings-behavior.tsx @@ -51,10 +51,8 @@ export function SettingsBehavior() { extractFilesByDefault: userPreferences.extractFilesByDefault ?? true, enableSteamAchievements: userPreferences.enableSteamAchievements ?? false, - autoplayGameTrailers: - userPreferences.autoplayGameTrailers ?? true, - hideToTrayOnGameStart: - userPreferences.hideToTrayOnGameStart ?? false, + autoplayGameTrailers: userPreferences.autoplayGameTrailers ?? true, + hideToTrayOnGameStart: userPreferences.hideToTrayOnGameStart ?? false, }); } }, [userPreferences]); From dbf5d7afc76bdfb7620c2597c744453a89cf40ad Mon Sep 17 00:00:00 2001 From: Moyasee Date: Tue, 28 Oct 2025 17:43:19 +0200 Subject: [PATCH 3/3] fix: multiple imports --- src/main/services/process-watcher.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index 4130daba..6408c30d 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -1,11 +1,10 @@ import { WindowManager } from "./window-manager"; import { createGame, updateGamePlaytime } from "./library-sync"; -import type { Game, GameRunning } from "@types"; +import type { Game, GameRunning, UserPreferences } from "@types"; import { PythonRPC } from "./python-rpc"; import axios from "axios"; import { ProcessPayload } from "./download/types"; 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";