feat: separate per-app keep awake from full screen

This commit is contained in:
Blendman974 committed 2026-11-06 03:29:23 +01:00
1 parent 7ba73c7659
commit 772d5e0fe7
7 files changed
+105 -21

No files matched your search

+17
View File
@@ -164,6 +164,23 @@ export function appFullscreenSetting(appId: string): ConfigSettingBoolean {
return setting;
}
const appKeepAwakeSettings = new Map<string, ConfigSettingBoolean>();
/** Independent of full screen; applies only while this app is visible. */
export function appKeepAwakeSetting(appId: string): ConfigSettingBoolean {
let setting = appKeepAwakeSettings.get(appId);
if (!setting) {
setting = new ConfigSettingBoolean({
id: `app-keep-awake-${appId}`, label: "Keep screen awake",
description: "Prevent automatic sleep while this app is visible, in any display mode.",
storageKey: `display.keepAwake.${appId}`, defaultValue: false,
reportInAnalytics: false,
});
appKeepAwakeSettings.set(appId, setting);
}
return setting;
}
type ConfigSettingEnumOptions<TValue extends string, TId extends string> = ConfigSettingOptions<TValue, TId> & {
values: readonly TValue[];
normalize?: (value: string | null | undefined) => TValue;