forked from Blendman974/faceclaw
Merge per-app full screen and keep-awake behavior
This commit is contained in:
11 files changed
+162
-6
No files matched your search
@@ -452,6 +452,8 @@ class DashboardController {
|
||||
openNotificationsWindow: () =>
|
||||
this.openInProcessAppInBackground(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow),
|
||||
onSwitcherBarHeightChanged: () => this.applySwitcherBarHeight(),
|
||||
onWindowLayoutChanged: () => this.applySwitcherBarHeight(),
|
||||
isLocked: () => this.glassesLocked,
|
||||
onScreenStateChanged: (on) => {
|
||||
// Any wake of the regular UI replaces a showing Glanceboard.
|
||||
if (on) this.glance.dismiss();
|
||||
|
||||
@@ -218,6 +218,12 @@ export class IosPreviewController {
|
||||
shell.foregroundWindow()?.requestRender()
|
||||
this.requestShellRender()
|
||||
},
|
||||
onWindowLayoutChanged: () => {
|
||||
this.relayout()
|
||||
shell.foregroundWindow()?.requestRender()
|
||||
this.requestShellRender()
|
||||
},
|
||||
isLocked: () => this.glassesLocked,
|
||||
onScreenStateChanged: on => {
|
||||
if (on) this.glance.dismiss()
|
||||
// A wake unblanks only once the next shell render has staged an awake
|
||||
|
||||
@@ -149,6 +149,22 @@ export class ConfigSettingBoolean<TId extends string = string> extends ConfigSet
|
||||
}
|
||||
}
|
||||
|
||||
const appFullscreenSettings = new Map<string, ConfigSettingBoolean>();
|
||||
|
||||
/** A user choice independent of an app's own temporary immersive mode. */
|
||||
export function appFullscreenSetting(appId: string): ConfigSettingBoolean {
|
||||
let setting = appFullscreenSettings.get(appId);
|
||||
if (!setting) {
|
||||
setting = new ConfigSettingBoolean({
|
||||
id: `app-fullscreen-${appId}`, label: "Full screen",
|
||||
storageKey: `display.fullscreen.${appId}`, defaultValue: false,
|
||||
reportInAnalytics: false,
|
||||
});
|
||||
appFullscreenSettings.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;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../../graphics/image";
|
||||
import {
|
||||
appSwitcherPositionSetting,
|
||||
appFullscreenSetting,
|
||||
type AppSwitcherPosition,
|
||||
displayLayoutSetting,
|
||||
type DisplayLayout,
|
||||
@@ -118,7 +119,7 @@ export function setAppImmersive(appId: string, immersive: boolean): boolean {
|
||||
}
|
||||
|
||||
export function isImmersive(appId?: string): boolean {
|
||||
return appId !== undefined && immersiveApps.has(appId);
|
||||
return appId !== undefined && (immersiveApps.has(appId) || appFullscreenSetting(appId).get());
|
||||
}
|
||||
|
||||
/** Whether an app's windows span the panel's whole width: Full Screen, or immersive. */
|
||||
|
||||
+26
-1
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user