forked from Blendman974/faceclaw
[verified] merge upstream 25cb255b into all-features
This commit is contained in:
commit
ffcdae660d
169 files changed
+16201
-597
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
isWatchInput,
|
||||
makeInputEvent,
|
||||
} from "../gestures";
|
||||
import type { KeyEvent } from "../../g2/keyboard/keys";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, noopLayerActions } from "../layers";
|
||||
import { CONTEXT_MENU_DIM, MenuLayer, type MenuItem } from "../menu";
|
||||
import { VoiceInputLayer, type VoiceSendTarget } from "./voice-input";
|
||||
@@ -158,6 +159,13 @@ export type ShellWindow = {
|
||||
* draws this window's top bar.
|
||||
*/
|
||||
heightMode: WindowHeightMode;
|
||||
/**
|
||||
* False for a window that must not bring its app back when Faceclaw
|
||||
* restarts (the controller's open-apps restore relaunches apps, not
|
||||
* windows): one that shows something a plain launch of its app would not,
|
||||
* where the relaunch would do something else in its place.
|
||||
*/
|
||||
restoresApp?: boolean;
|
||||
/** App-side cleanup when the shell closes the window (worker notification, surface removal). */
|
||||
close?: () => void;
|
||||
drawIcon: ShellChromeWindow["drawIcon"];
|
||||
@@ -192,6 +200,15 @@ export type ShellWindow = {
|
||||
* only windows that consume typed text (the terminal) implement it.
|
||||
*/
|
||||
receiveTextInput?: (text: string, options?: { submit?: boolean }) => void;
|
||||
/**
|
||||
* Take a key from a hardware keyboard (app/g2/keyboard) as a key. Optional:
|
||||
* only windows that give keys a meaning of their own (the terminal)
|
||||
* implement it. They get the keys no keybinding claimed while they have
|
||||
* input focus, presses and releases alike; the rest of the time, and for
|
||||
* every other window, the navigation keys act as gestures (see
|
||||
* app/g2/keyboard/bindings.ts).
|
||||
*/
|
||||
handleKeyEvent?: (event: KeyEvent) => void;
|
||||
/** Foreground state changed: this window's surface is (not) the visible one. */
|
||||
setForeground?: (foreground: boolean) => void;
|
||||
/**
|
||||
@@ -1671,6 +1688,21 @@ class Shell {
|
||||
this.foregroundWindow()?.receiveTextInput?.(text, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offer a hardware-keyboard key to the window that has input focus. True
|
||||
* when that window takes keys (ShellWindow.handleKeyEvent) and got this
|
||||
* one; false when the key is the caller's to interpret: the screen is off,
|
||||
* the sidebar or a shell overlay has focus, or the window has no use for
|
||||
* keys. Typing counts as activity for the screen timeout.
|
||||
*/
|
||||
receiveKeyEvent(event: KeyEvent): boolean {
|
||||
const window = this.inputTargetWindow();
|
||||
if (!window?.handleKeyEvent) return false;
|
||||
if (event.phase === "down") this.lastInputAtMs = Date.now();
|
||||
window.handleKeyEvent(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the voice dialog aimed at the foreground window. Called when the
|
||||
* user picks Voice input from the system menu (or an app asks via a
|
||||
|
||||
Reference in new issue
Block a user