Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
adb9e96
feat(settings): add controller theme customization options
Jayian1890 May 2, 2026
78ed48f
refactor(styles): update theme colors in CSS for improved consistency
Jayian1890 May 2, 2026
dfb7ab2
feat(styles): implement PS5-style layout and animations for game hub
Jayian1890 May 2, 2026
a8a6bce
feat(controller): enhance ControllerLibraryPage with media navigation…
Jayian1890 May 2, 2026
89c200c
feat(controller): enhance PS5 row navigation and detail rail function…
Jayian1890 May 2, 2026
3fc4f03
feat(controller): refine PS5 row navigation and CSS styles
Jayian1890 May 2, 2026
41b7b96
feat(controller): update PS5 menu styles and navigation logic
Jayian1890 May 2, 2026
1d49ef1
feat(controller): enhance navigation and sorting in ControllerLibrary…
Jayian1890 May 3, 2026
0cfc580
feat(controller): improve shelf navigation and CSS transitions
Jayian1890 May 3, 2026
e68975f
feat(controller): implement full-screen game hub styles and navigatio…
Jayian1890 May 3, 2026
b58e2e4
feat(controller): enhance game hub visuals and screenshot handling
Jayian1890 May 3, 2026
b82198c
feat(controller): enhance cloud session resume functionality and PS5-…
Jayian1890 May 3, 2026
8dbf659
feat(controller): improve session claim handling and deduplication
Jayian1890 May 3, 2026
4a7f3d9
feat(controller): enhance in-stream menu functionality and visuals
Jayian1890 May 3, 2026
51e36dd
refactor(controller): remove unused stream preset functionality and c…
Jayian1890 May 3, 2026
20e956a
refactor(controller): remove unused remaining playtime functionality …
Jayian1890 May 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion opennow-stable/src/main/settings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { app } from "electron";
import { join } from "node:path";
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
import type { VideoCodec, ColorQuality, VideoAccelerationPreference, MicrophoneMode, GameLanguage, AspectRatio, KeyboardLayout } from "@shared/gfn";
import type {
VideoCodec,
ColorQuality,
VideoAccelerationPreference,
MicrophoneMode,
GameLanguage,
AspectRatio,
KeyboardLayout,
ControllerThemeRgb,
ControllerThemeStyle,
} from "@shared/gfn";
import { DEFAULT_KEYBOARD_LAYOUT, getDefaultStreamPreferences, normalizeStreamPreferences } from "@shared/gfn";

export interface Settings {
Expand Down Expand Up @@ -69,6 +79,10 @@ export interface Settings {
controllerUiSounds: boolean;
/** Enable animated background visuals for controller-mode loading screens */
controllerBackgroundAnimations: boolean;
/** Controller-mode library background visual preset */
controllerThemeStyle: ControllerThemeStyle;
/** Controller-mode library background tint */
controllerThemeColor: ControllerThemeRgb;
/** Auto-load controller library at startup when controller mode is enabled */
autoLoadControllerLibrary: boolean;
/** Automatically enter fullscreen when controller-mode triggers it */
Expand Down Expand Up @@ -103,6 +117,28 @@ const LEGACY_STOP_SHORTCUTS = new Set(["META+SHIFT+Q", "CMD+SHIFT+Q"]);
const LEGACY_ANTI_AFK_SHORTCUTS = new Set(["META+SHIFT+F10", "CMD+SHIFT+F10", "CTRL+SHIFT+F10"]);
const DEFAULT_STREAM_PREFERENCES = getDefaultStreamPreferences();

const CONTROLLER_THEME_STYLES_SET = new Set<ControllerThemeStyle>(["aurora", "nebula", "grid", "minimal", "pulse"]);

function clampThemeByte(value: unknown): number {
const n = typeof value === "number" && Number.isFinite(value) ? Math.round(value) : NaN;
if (!Number.isFinite(n)) return 0;
return Math.max(0, Math.min(255, n));
}

function normalizeControllerThemeColor(raw: unknown, fallback: ControllerThemeRgb): ControllerThemeRgb {
if (!raw || typeof raw !== "object") return { ...fallback };
const o = raw as Record<string, unknown>;
return {
r: clampThemeByte(o.r),
g: clampThemeByte(o.g),
b: clampThemeByte(o.b),
};
}

function normalizeControllerThemeStyle(raw: unknown): ControllerThemeStyle {
return CONTROLLER_THEME_STYLES_SET.has(raw as ControllerThemeStyle) ? (raw as ControllerThemeStyle) : "aurora";
}

const DEFAULT_SETTINGS: Settings = {
resolution: "1920x1080",
aspectRatio: "16:9",
Expand Down Expand Up @@ -134,6 +170,8 @@ const DEFAULT_SETTINGS: Settings = {
controllerMode: false,
controllerUiSounds: false,
controllerBackgroundAnimations: false,
controllerThemeStyle: "aurora",
controllerThemeColor: { r: 124, g: 241, b: 177 },
autoLoadControllerLibrary: false,
autoFullScreen: false,
favoriteGameIds: [],
Expand Down Expand Up @@ -183,6 +221,19 @@ export class SettingsManager {
let migrated = this.migrateLegacyShortcutDefaults(merged);
migrated = this.enforceCompatibility(merged) || migrated;

const themeStyleBefore = merged.controllerThemeStyle;
const themeColorBefore = { ...merged.controllerThemeColor };
merged.controllerThemeStyle = normalizeControllerThemeStyle(merged.controllerThemeStyle);
merged.controllerThemeColor = normalizeControllerThemeColor(merged.controllerThemeColor, DEFAULT_SETTINGS.controllerThemeColor);
if (
merged.controllerThemeStyle !== themeStyleBefore ||
merged.controllerThemeColor.r !== themeColorBefore.r ||
merged.controllerThemeColor.g !== themeColorBefore.g ||
merged.controllerThemeColor.b !== themeColorBefore.b
) {
migrated = true;
}

// Migrate legacy boolean accelerator setting to percentage slider.
if (typeof (parsed as { mouseAcceleration?: unknown }).mouseAcceleration === "boolean") {
merged.mouseAcceleration = (parsed as { mouseAcceleration?: boolean }).mouseAcceleration ? 100 : 1;
Expand Down
Loading
Loading