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: () =>
|
openNotificationsWindow: () =>
|
||||||
this.openInProcessAppInBackground(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow),
|
this.openInProcessAppInBackground(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow),
|
||||||
onSwitcherBarHeightChanged: () => this.applySwitcherBarHeight(),
|
onSwitcherBarHeightChanged: () => this.applySwitcherBarHeight(),
|
||||||
|
onWindowLayoutChanged: () => this.applySwitcherBarHeight(),
|
||||||
|
isLocked: () => this.glassesLocked,
|
||||||
onScreenStateChanged: (on) => {
|
onScreenStateChanged: (on) => {
|
||||||
// Any wake of the regular UI replaces a showing Glanceboard.
|
// Any wake of the regular UI replaces a showing Glanceboard.
|
||||||
if (on) this.glance.dismiss();
|
if (on) this.glance.dismiss();
|
||||||
|
|||||||
@@ -218,6 +218,12 @@ export class IosPreviewController {
|
|||||||
shell.foregroundWindow()?.requestRender()
|
shell.foregroundWindow()?.requestRender()
|
||||||
this.requestShellRender()
|
this.requestShellRender()
|
||||||
},
|
},
|
||||||
|
onWindowLayoutChanged: () => {
|
||||||
|
this.relayout()
|
||||||
|
shell.foregroundWindow()?.requestRender()
|
||||||
|
this.requestShellRender()
|
||||||
|
},
|
||||||
|
isLocked: () => this.glassesLocked,
|
||||||
onScreenStateChanged: on => {
|
onScreenStateChanged: on => {
|
||||||
if (on) this.glance.dismiss()
|
if (on) this.glance.dismiss()
|
||||||
// A wake unblanks only once the next shell render has staged an awake
|
// 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> & {
|
type ConfigSettingEnumOptions<TValue extends string, TId extends string> = ConfigSettingOptions<TValue, TId> & {
|
||||||
values: readonly TValue[];
|
values: readonly TValue[];
|
||||||
normalize?: (value: string | null | undefined) => TValue;
|
normalize?: (value: string | null | undefined) => TValue;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../../graphics/image";
|
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../../graphics/image";
|
||||||
import {
|
import {
|
||||||
appSwitcherPositionSetting,
|
appSwitcherPositionSetting,
|
||||||
|
appFullscreenSetting,
|
||||||
type AppSwitcherPosition,
|
type AppSwitcherPosition,
|
||||||
displayLayoutSetting,
|
displayLayoutSetting,
|
||||||
type DisplayLayout,
|
type DisplayLayout,
|
||||||
@@ -118,7 +119,7 @@ export function setAppImmersive(appId: string, immersive: boolean): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isImmersive(appId?: string): 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. */
|
/** 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 { SingleNotificationLayer } from "../notifications";
|
||||||
import {
|
import {
|
||||||
anthropicApiKeySetting,
|
anthropicApiKeySetting,
|
||||||
|
appFullscreenSetting,
|
||||||
assistantHermesKeySetting,
|
assistantHermesKeySetting,
|
||||||
assistantHermesUrlSetting,
|
assistantHermesUrlSetting,
|
||||||
assistantBackendSetting,
|
assistantBackendSetting,
|
||||||
@@ -73,6 +74,8 @@ import { BrightnessPickerLayer } from "./brightness-picker-layer";
|
|||||||
import { toolRegistry } from "../../assistant/tool-registry";
|
import { toolRegistry } from "../../assistant/tool-registry";
|
||||||
import {
|
import {
|
||||||
appViewportRect,
|
appViewportRect,
|
||||||
|
displayLayout,
|
||||||
|
isImmersive,
|
||||||
minWindowTop,
|
minWindowTop,
|
||||||
sidebarWidth,
|
sidebarWidth,
|
||||||
switcherPosition,
|
switcherPosition,
|
||||||
@@ -223,6 +226,10 @@ export type ShellConfig = {
|
|||||||
* after the shell paint that found it.
|
* after the shell paint that found it.
|
||||||
*/
|
*/
|
||||||
onSwitcherBarHeightChanged?: () => void;
|
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
|
* The Notifications app's window, opened in the background (neither
|
||||||
* foregrounded nor focused) unless it is open already, for the switcher
|
* 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.
|
// A foreground window that is playing video holds it off the same way.
|
||||||
const foreground = this.foregroundWindow();
|
const foreground = this.foregroundWindow();
|
||||||
if (this.activeVoiceLayer || this.activeKeyboardLayer || this.assistantSession?.isTurnActive() ||
|
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;
|
this.lastInputAtMs = nowMs;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1980,6 +1989,22 @@ class Shell {
|
|||||||
this.closeAllWindows();
|
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") {
|
if (brightnessSetting.get() !== "auto") {
|
||||||
items.push({
|
items.push({
|
||||||
label: "Brightness",
|
label: "Brightness",
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Per-app full screen
|
||||||
|
|
||||||
|
Long-press opens the system menu. Closeable apps offer Enter full screen / Exit
|
||||||
|
full screen. The choice persists per app through the existing settings store,
|
||||||
|
independently of global display layout and app-controlled immersive mode.
|
||||||
|
Full screen fills the 640x480 panel, hides chrome while the app has focus, and
|
||||||
|
resizes existing in-process and worker windows without restarting the app.
|
||||||
|
The switcher remains accessible through the system menu.
|
||||||
|
|
||||||
|
Automatic idle sleep is suspended while a closeable full-screen/immersive app
|
||||||
|
is in the foreground. A background full-screen app does not hold the display
|
||||||
|
awake. The lock screen and explicit sleep still work. The inactivity countdown
|
||||||
|
starts fresh after leaving a kept-awake app.
|
||||||
|
|
||||||
|
Software regressions cover geometry with every switcher position, preserving
|
||||||
|
other display settings and persistence after reload, captured menu targets,
|
||||||
|
exit, foreground/background idle behavior, lock timeout and manual sleep.
|
||||||
|
|
||||||
|
On glasses, verify entry/exit from both in-process apps and worker apps,
|
||||||
|
reflow, state retention, idle timeout, app switching, lock/off-head behavior,
|
||||||
|
and reconnection. These hardware checks remain pending. No firmware change.
|
||||||
@@ -267,6 +267,7 @@ function shellEnv({ wakeAction = 'voice-input', skipConfirmation = false } = {})
|
|||||||
}
|
}
|
||||||
const voiceDialogs = [];
|
const voiceDialogs = [];
|
||||||
const settings = { wakeWordActionSetting: { get: () => wakeAction }, brightnessSetting: { get: () => 'auto' },
|
const settings = { wakeWordActionSetting: { get: () => wakeAction }, brightnessSetting: { get: () => 'auto' },
|
||||||
|
appFullscreenSetting: () => ({ get: () => false }),
|
||||||
assistantSkipConfirmationSetting: { get: () => skipConfirmation } };
|
assistantSkipConfirmationSetting: { get: () => skipConfirmation } };
|
||||||
const { shell, rawInputEventToInputEvent } = load('app/ui/shell/shell.ts', {
|
const { shell, rawInputEventToInputEvent } = load('app/ui/shell/shell.ts', {
|
||||||
'../../graphics/shell-scene': { encodeShellScene: () => new Uint8Array([0, 0]) },
|
'../../graphics/shell-scene': { encodeShellScene: () => new Uint8Array([0, 0]) },
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ function geometry() {
|
|||||||
appSwitcherPositionSetting: 'left', uiDepthSetting: '0', statusBarPositionSetting: 'top',
|
appSwitcherPositionSetting: 'left', uiDepthSetting: '0', statusBarPositionSetting: 'top',
|
||||||
statusBarVisibilitySetting: 'always', windowBorderSetting: true,
|
statusBarVisibilitySetting: 'always', windowBorderSetting: true,
|
||||||
}).map(([name, value]) => [name, { value, get() { return this.value; } }]));
|
}).map(([name, value]) => [name, { value, get() { return this.value; } }]));
|
||||||
|
const fullscreen = new Map();
|
||||||
|
settings.appFullscreenSetting = id => ({ get: () => fullscreen.get(id) ?? false, set: value => fullscreen.set(id, value) });
|
||||||
const context = { exports: {}, require: (name) => {
|
const context = { exports: {}, require: (name) => {
|
||||||
if (name === '../../graphics/image') return { G2_LENS_WIDTH: 640, G2_LENS_HEIGHT: 480 };
|
if (name === '../../graphics/image') return { G2_LENS_WIDTH: 640, G2_LENS_HEIGHT: 480 };
|
||||||
assert.equal(name, '../dashboard-settings');
|
assert.equal(name, '../dashboard-settings');
|
||||||
@@ -27,6 +29,25 @@ function geometry() {
|
|||||||
|
|
||||||
const LAYOUTS = ['band-top', 'band-high', 'band-middle', 'band-low', 'band-bottom', 'tall', 'fullscreen'];
|
const LAYOUTS = ['band-top', 'band-high', 'band-middle', 'band-low', 'band-bottom', 'tall', 'fullscreen'];
|
||||||
|
|
||||||
|
test('user full screen spans the panel with any switcher and survives app immersive cleanup', () => {
|
||||||
|
const g = geometry();
|
||||||
|
const previous = g.rect('min', 'test');
|
||||||
|
for (const position of ['left', 'right', 'bottom', 'popup']) {
|
||||||
|
g.settings.appSwitcherPositionSetting.value = position;
|
||||||
|
g.settings.appFullscreenSetting('test').set(true);
|
||||||
|
assert.deepEqual(g.rect('min', 'test'), { x: 0, y: 0, width: 640, height: 480 });
|
||||||
|
assert.equal(g.sidebarStripVisible('window', 'test'), false);
|
||||||
|
assert.equal(g.sidebarStripVisible('sidebar', 'test'), true);
|
||||||
|
g.setAppImmersive('test', true);
|
||||||
|
g.setAppImmersive('test', false);
|
||||||
|
assert.equal(g.isImmersive('test'), true);
|
||||||
|
assert.equal(g.isImmersive('other'), false);
|
||||||
|
}
|
||||||
|
g.settings.appSwitcherPositionSetting.value = 'left';
|
||||||
|
g.settings.appFullscreenSetting('test').set(false);
|
||||||
|
assert.deepEqual(g.rect('min', 'test'), previous);
|
||||||
|
});
|
||||||
|
|
||||||
test('defaults preserve normal windows, EvenHub height and tall terminal sessions', () => {
|
test('defaults preserve normal windows, EvenHub height and tall terminal sessions', () => {
|
||||||
const g = geometry();
|
const g = geometry();
|
||||||
assert.deepEqual(g.rect('min', 'navigate'), { x: 64, y: 124, width: 576, height: 260 });
|
assert.deepEqual(g.rect('min', 'navigate'), { x: 64, y: 124, width: 576, height: 260 });
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function fixture(options = {}) {
|
|||||||
const source = ts.createSourceFile('shell.ts', fs.readFileSync(path.join(__dirname, '../app/ui/shell/shell.ts'), 'utf8'), ts.ScriptTarget.Latest, true);
|
const source = ts.createSourceFile('shell.ts', fs.readFileSync(path.join(__dirname, '../app/ui/shell/shell.ts'), 'utf8'), ts.ScriptTarget.Latest, true);
|
||||||
const shellClass = source.statements.find(node => ts.isClassDeclaration(node) && node.name.text === 'Shell');
|
const shellClass = source.statements.find(node => ts.isClassDeclaration(node) && node.name.text === 'Shell');
|
||||||
const names = new Set(['routeInput', 'openEscapeMenu', 'closeAllWindows', 'closeWindow', 'removeWindow',
|
const names = new Set(['routeInput', 'openEscapeMenu', 'closeAllWindows', 'closeWindow', 'removeWindow',
|
||||||
'foregroundWindow', 'noteWindowVisible', 'mostRecentWindowIndex', 'yieldFocusToSidebar']);
|
'foregroundWindow', 'noteWindowVisible', 'mostRecentWindowIndex', 'yieldFocusToSidebar', 'applyScreenTimeout']);
|
||||||
const methods = shellClass.members.filter(node => names.has(node.name?.getText(source)));
|
const methods = shellClass.members.filter(node => names.has(node.name?.getText(source)));
|
||||||
assert.equal(methods.length, names.size);
|
assert.equal(methods.length, names.size);
|
||||||
const overlay = source.statements.find(node => ts.isClassDeclaration(node) && node.name.text === 'ShellOverlayMenuLayer');
|
const overlay = source.statements.find(node => ts.isClassDeclaration(node) && node.name.text === 'ShellOverlayMenuLayer');
|
||||||
@@ -17,12 +17,15 @@ function fixture(options = {}) {
|
|||||||
constructor(title, items) { this.title = title; this.items = items; }
|
constructor(title, items) { this.title = title; this.items = items; }
|
||||||
selectItem(index) { this.selectedIndex = index; }
|
selectItem(index) { this.selectedIndex = index; }
|
||||||
}
|
}
|
||||||
|
const fullscreen = new Map();
|
||||||
const context = {
|
const context = {
|
||||||
exports: {}, MenuLayer, console: { warn: () => {} },
|
exports: {}, MenuLayer, console: { warn: () => {} },
|
||||||
appViewportRect: () => ({ x: 0, y: 0, width: 576 }), CONTEXT_MENU_DIM: 0.5,
|
appViewportRect: () => ({ x: 0, y: 0, width: 576 }), CONTEXT_MENU_DIM: 0.5,
|
||||||
brightnessSetting: { get: () => 'auto' }, gestureHints: () => 'App menu',
|
brightnessSetting: { get: () => 'auto' }, gestureHints: () => 'App menu',
|
||||||
GESTURE_SHORT_THEN_LONG_PRESS: 'tap-hold', makeInputEvent: event => event,
|
GESTURE_SHORT_THEN_LONG_PRESS: 'tap-hold', makeInputEvent: event => event,
|
||||||
isWatchInput: event => event.source === 'watch', isDirectionalInput: () => false,
|
isWatchInput: event => event.source === 'watch', isDirectionalInput: () => false,
|
||||||
|
appFullscreenSetting: id => ({ get: () => fullscreen.get(id) ?? false, set: value => fullscreen.set(id, value) }),
|
||||||
|
isImmersive: id => fullscreen.get(id) ?? false, displayLayout: () => 'band-middle',
|
||||||
};
|
};
|
||||||
vm.runInNewContext(ts.transpileModule(`${overlay.getText(source)}\nexport class Shell { ${methods.map(node => node.getText(source)).join('\n')} }`, {
|
vm.runInNewContext(ts.transpileModule(`${overlay.getText(source)}\nexport class Shell { ${methods.map(node => node.getText(source)).join('\n')} }`, {
|
||||||
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
||||||
@@ -54,6 +57,10 @@ function fixture(options = {}) {
|
|||||||
config: { voiceInputEnabled: false, requestShellRender() {}, onWindowsChanged() {} },
|
config: { voiceInputEnabled: false, requestShellRender() {}, onWindowsChanged() {} },
|
||||||
cancelEscapeMenuTimer() {}, startEscapeMenuTimer() { s.escapeStarted = true; },
|
cancelEscapeMenuTimer() {}, startEscapeMenuTimer() { s.escapeStarted = true; },
|
||||||
lastInput: null,
|
lastInput: null,
|
||||||
|
lastInputAtMs: 0,
|
||||||
|
noteUserActivity() { this.lastInputAtMs = 100; },
|
||||||
|
focusWindow(id) { this.selectedIndex = this.windows.findIndex(w => w.windowId === id); this.focus = 'window'; },
|
||||||
|
sleep() { this.screenOn = false; },
|
||||||
});
|
});
|
||||||
const input = type => s.routeInput({ type, source: 'ring', timestampMs: 100 }, 1);
|
const input = type => s.routeInput({ type, source: 'ring', timestampMs: 100 }, 1);
|
||||||
const menu = () => layers.at(-1);
|
const menu = () => layers.at(-1);
|
||||||
@@ -62,9 +69,50 @@ function fixture(options = {}) {
|
|||||||
assert.ok(item, label);
|
assert.ok(item, label);
|
||||||
item.onSelect({ stack: s.stack });
|
item.onSelect({ stack: s.stack });
|
||||||
};
|
};
|
||||||
return { s, input, menu, choose, closed, delivered, warnings, renders, launcher, app, background, window };
|
return { s, input, menu, choose, closed, delivered, warnings, renders, launcher, app, background, window, fullscreen };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test('full screen targets the captured app and keeps only the visible app awake', async () => {
|
||||||
|
const h = fixture();
|
||||||
|
h.s.config.getScreenTimeoutMs = () => 1000;
|
||||||
|
let relayouts = 0;
|
||||||
|
h.s.config.onWindowLayoutChanged = () => relayouts++;
|
||||||
|
await h.input('long-press');
|
||||||
|
h.s.selectedIndex = 2;
|
||||||
|
h.choose('Enter full screen');
|
||||||
|
assert.equal(h.fullscreen.get('current'), true);
|
||||||
|
assert.equal(h.s.foregroundWindow().windowId, 'current');
|
||||||
|
assert.equal(h.s.focus, 'window');
|
||||||
|
assert.equal(relayouts, 1);
|
||||||
|
assert.equal(h.s.applyScreenTimeout(5000), false);
|
||||||
|
h.s.focusWindow('background');
|
||||||
|
assert.equal(h.s.applyScreenTimeout(5500), false);
|
||||||
|
assert.equal(h.s.applyScreenTimeout(6000), true);
|
||||||
|
h.s.screenOn = true;
|
||||||
|
h.s.focusWindow('current');
|
||||||
|
await h.input('long-press');
|
||||||
|
h.choose('Exit full screen');
|
||||||
|
assert.equal(h.fullscreen.get('current'), false);
|
||||||
|
assert.equal(relayouts, 2);
|
||||||
|
assert.equal(h.s.applyScreenTimeout(7000), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('full screen does not suppress lock timeout or manual sleep, and is absent for the launcher', async () => {
|
||||||
|
const h = fixture();
|
||||||
|
h.fullscreen.set('current', true);
|
||||||
|
h.s.config.getScreenTimeoutMs = () => 1000;
|
||||||
|
h.s.config.isLocked = () => true;
|
||||||
|
assert.equal(h.s.applyScreenTimeout(5000), true);
|
||||||
|
h.s.screenOn = true;
|
||||||
|
h.s.config.isLocked = () => false;
|
||||||
|
h.s.sleep();
|
||||||
|
assert.equal(h.s.screenOn, false);
|
||||||
|
h.s.screenOn = true;
|
||||||
|
h.s.selectedIndex = 0;
|
||||||
|
await h.input('long-press');
|
||||||
|
assert.ok(!h.menu().items.some(item => /full screen/.test(item.label)));
|
||||||
|
});
|
||||||
|
|
||||||
test('switcher opens its menu on hold or tap-hold even for an app claiming holds or hold-to-talk', async () => {
|
test('switcher opens its menu on hold or tap-hold even for an app claiming holds or hold-to-talk', async () => {
|
||||||
for (const type of ['long-press', 'short-then-long-press']) {
|
for (const type of ['long-press', 'short-then-long-press']) {
|
||||||
for (const app of [{}, { claimsLongPress: () => true }, { holdToTalk: true }]) {
|
for (const app of [{}, { claimsLongPress: () => true }, { holdToTalk: true }]) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ const menu = load('app/ui/menu.ts', {
|
|||||||
function fixture(initial = '50', viewport = { x: 64, y: 124, width: 576, height: 260 }) {
|
function fixture(initial = '50', viewport = { x: 64, y: 124, width: 576, height: 260 }) {
|
||||||
let value = initial, writes = 0, closed = 0;
|
let value = initial, writes = 0, closed = 0;
|
||||||
const settings = {
|
const settings = {
|
||||||
|
appFullscreenSetting: () => ({ get: () => false }),
|
||||||
brightnessSetting: { get: () => value, set: (next) => { value = next; writes++; } },
|
brightnessSetting: { get: () => value, set: (next) => { value = next; writes++; } },
|
||||||
brightnessSettingToLevel: (value) => value === 'auto' ? null : Number(value),
|
brightnessSettingToLevel: (value) => value === 'auto' ? null : Number(value),
|
||||||
};
|
};
|
||||||
@@ -120,13 +121,14 @@ test('system menu hides brightness in Auto and opens its picker between Voice in
|
|||||||
shell.openSystemMenu('test');
|
shell.openSystemMenu('test');
|
||||||
let opened = shell.stack.layers.at(-1);
|
let opened = shell.stack.layers.at(-1);
|
||||||
assert.deepEqual(Array.from(opened.items, (item) => item.label),
|
assert.deepEqual(Array.from(opened.items, (item) => item.label),
|
||||||
['Close current app', 'Focus app switcher', 'Voice input', 'Close all apps', 'Debug']);
|
['Close current app', 'Focus app switcher', 'Voice input', 'Close all apps', 'Enter full screen', 'Debug']);
|
||||||
shell.stack.clearToBase();
|
shell.stack.clearToBase();
|
||||||
f.settings.brightnessSetting.set('40');
|
f.settings.brightnessSetting.set('40');
|
||||||
shell.openSystemMenu('test');
|
shell.openSystemMenu('test');
|
||||||
opened = shell.stack.layers.at(-1);
|
opened = shell.stack.layers.at(-1);
|
||||||
assert.deepEqual(Array.from(opened.items, (item) => item.label),
|
assert.deepEqual(Array.from(opened.items, (item) => item.label),
|
||||||
['Close current app', 'Focus app switcher', 'Voice input', 'Close all apps', 'Brightness', 'Debug']);
|
['Close current app', 'Focus app switcher', 'Voice input', 'Close all apps', 'Enter full screen', 'Brightness', 'Debug']);
|
||||||
|
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
||||||
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
||||||
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
||||||
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
await shell.stack.handleInput(gestures.makeInputEvent({ type: 'scroll-down' }));
|
||||||
|
|||||||
@@ -65,3 +65,16 @@ test('Full Screen is offered only with a bottom or popup app switcher', () => {
|
|||||||
assert.deepEqual(Array.from(api.DISPLAY_LAYOUT_VALUES, (value) => api.displayLayoutLabel(value)),
|
assert.deepEqual(Array.from(api.DISPLAY_LAYOUT_VALUES, (value) => api.displayLayoutLabel(value)),
|
||||||
['Band · Top', 'Band · High', 'Band · Middle', 'Band · Low', 'Band · Bottom', 'Tall', 'Full Screen']);
|
['Band · Top', 'Band · High', 'Band · Middle', 'Band · Low', 'Band · Bottom', 'Tall', 'Full Screen']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('per-app full screen defaults off, persists across restart and preserves display preferences', () => {
|
||||||
|
const store = new Map([['display.layout', 'band-low'], ['terminal.displayLayout', 'tall']]);
|
||||||
|
const prefs = settingsFixture(store);
|
||||||
|
assert.equal(prefs.appFullscreenSetting('terminal').get(), false);
|
||||||
|
prefs.appFullscreenSetting('terminal').set(true);
|
||||||
|
const restarted = settingsFixture(store);
|
||||||
|
assert.equal(restarted.appFullscreenSetting('terminal').get(), true);
|
||||||
|
assert.equal(restarted.appFullscreenSetting('other').get(), false);
|
||||||
|
restarted.appFullscreenSetting('terminal').set(false);
|
||||||
|
assert.equal(restarted.displayLayoutSetting.get(), 'band-low');
|
||||||
|
assert.equal(store.get('terminal.displayLayout'), 'tall');
|
||||||
|
});
|
||||||
Reference in new issue
Block a user