Dim the screen underneath when a context menu is open

This commit is contained in:
James Babcock committed 2026-09-03 01:25:10 -07:00
1 parent 83c3732ba7
commit 9234458dd6
13 files changed
+211 -14

No files matched your search

+13 -1
View File
@@ -15,7 +15,7 @@ import {
makeInputEvent,
} from "../gestures";
import { Layer, LayerActions, LayerContext, LayerStack, noopLayerActions } from "../layers";
import { MenuLayer, type MenuItem } from "../menu";
import { CONTEXT_MENU_DIM, MenuLayer, type MenuItem } from "../menu";
import { VoiceInputLayer, type VoiceSendTarget } from "./voice-input";
import { voiceActivity } from "./voice-activity";
import { AssistantLayer } from "./assistant";
@@ -206,6 +206,7 @@ class ShellOverlayMenuLayer extends MenuLayer {
width,
minHeight: 150,
footer,
dimUnderneath: CONTEXT_MENU_DIM,
});
}
@@ -603,6 +604,17 @@ class Shell {
return this.stack.paint();
}
/**
* The brightness factor a shell overlay (a context menu) currently applies
* to what lies beneath the shell surface, i.e. the window surfaces: 1 when
* nothing dims them. Read after paintSurface; the controller forwards it to
* the compositor, which cannot see the shell's layer stack.
*/
underlayDim(): number {
const dim = this.stack.baseDim();
return this.screenOn && dim !== false ? dim : 1;
}
async receiveInput(event: InputEvent, frameId = 0): Promise<ShellInputOutcome> {
const previous = this.lastInput;
this.lastInput = event;