feat: per-app full screen with idle sleep inhibition

This commit is contained in:
Blendman974 committed 2026-11-06 03:18:01 +01:00
1 parent be939f401b
commit 7ba73c7659
11 files changed
+162 -6

No files matched your search

+26 -1
View File
@@ -31,6 +31,7 @@ import type { AssistantContext } from "../../assistant/types";
import { SingleNotificationLayer } from "../notifications";
import {
anthropicApiKeySetting,
appFullscreenSetting,
assistantHermesKeySetting,
assistantHermesUrlSetting,
assistantBackendSetting,
@@ -73,6 +74,8 @@ import { BrightnessPickerLayer } from "./brightness-picker-layer";
import { toolRegistry } from "../../assistant/tool-registry";
import {
appViewportRect,
displayLayout,
isImmersive,
minWindowTop,
sidebarWidth,
switcherPosition,
@@ -223,6 +226,10 @@ export type ShellConfig = {
* after the shell paint that found it.
*/
onSwitcherBarHeightChanged?: () => void;
/** A per-app full-screen choice changed the viewport and compositor geometry. */
onWindowLayoutChanged?: () => void;
/** Full screen must not keep the lock screen awake. */
isLocked?: () => boolean;
/**
* The Notifications app's window, opened in the background (neither
* foregrounded nor focused) unless it is open already, for the switcher
@@ -873,7 +880,9 @@ class Shell {
// A foreground window that is playing video holds it off the same way.
const foreground = this.foregroundWindow();
if (this.activeVoiceLayer || this.activeKeyboardLayer || this.assistantSession?.isTurnActive() ||
foreground?.isVoiceCapturing?.() || foreground?.keepsScreenOn?.()) {
foreground?.isVoiceCapturing?.() || foreground?.keepsScreenOn?.() ||
(foreground?.closeable && !this.config.isLocked?.() &&
(isImmersive(foreground.appId) || displayLayout(foreground.appId) === "fullscreen"))) {
this.lastInputAtMs = nowMs;
return false;
}
@@ -1980,6 +1989,22 @@ class Shell {
this.closeAllWindows();
},
});
if (foreground.closeable) {
const fullscreen = appFullscreenSetting(foreground.appId);
items.push({
label: fullscreen.get() ? "Exit full screen" : "Enter full screen",
description: "Use the whole display and keep it awake while this app is visible.",
onSelect: (ctx) => {
ctx.stack.pop();
if (!this.windows.some(window => window.windowId === foreground.windowId)) return;
fullscreen.set(!fullscreen.get());
this.noteUserActivity();
this.config.onWindowLayoutChanged?.();
this.focusWindow(foreground.windowId);
this.config.requestShellRender();
},
});
}
if (brightnessSetting.get() !== "auto") {
items.push({
label: "Brightness",