export declare enum PortalKind { /** A yes/no question, such as whether an application may use the camera. */ Access = 0, /** Pick an application to open a file or URI with. */ AppChooser = 1, /** Files to open, or where to save. */ FileChooser = 2, /** * An application holding off logout, user switching or suspend, until it * lets go. Not a question: the compositor refuses answers to it. */ Inhibit = 3, /** Which input devices, and the clipboard, an application may control. */ RemoteDesktop = 4, /** Whether an application may take input that crosses a screen edge. */ InputCapture = 5, /** * A launcher an application would install. Answer with * {@link PortalAnswer.DynamicLauncher} and the name to install it under. */ DynamicLauncher = 6, /** USB devices an application would open. Allow them all with {@link PortalAnswer.Access}. */ Usb = 7, /** * Whether an application may have the user's name and picture. Allow it * with {@link PortalAnswer.Access}. */ Account = 8, /** Chords an application asks to hold while it is not focused. */ GlobalShortcuts = 9, /** * A picture to preview before it becomes the wallpaper. Allow it with * {@link PortalAnswer.Access}. */ Wallpaper = 10, /** A source picker: what an application may record. */ ScreenCast = 11, /** Pick a printer and its options. */ Print = 12, /** Pick the area of a frozen desk to save as a screenshot. */ Screenshot = 13, /** Pick a pixel of a frozen desk, for its color. */ PickColor = 14, /** * An agent, such as Claude Code through `domicile mcp`, asks to see and use * the desk: all of it, or only the windows the user checks. Answer with * {@link PortalAnswer.Agent}. */ Agent = 15, /** A kind this SDK cannot parse. Answer it with {@link PortalAnswer.Refused}. */ Unknown = 16 } /** * The {@link PortalRequestBase.appId} of a dialog the shell asked for itself, * such as the one `system(host).screenshot()` puts up. No application can have * it. */ export declare const SHELL_APP_ID = "domicile:shell"; /** What every request carries. */ export type PortalRequestBase = { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; }; /** An access dialog's texts. A missing label is the shell's to choose. */ export type AccessBody = { title: string; subtitle: string; body: string; grantLabel: string | undefined; denyLabel: string | undefined; /** Allowing cannot be undone, such as shutting down. */ destructive: boolean; }; /** What an app chooser opens, and the applications it offers. */ export type AppChooserBody = { /** Desktop file IDs without `.desktop`. May change while the dialog is up. */ choices: readonly string[]; /** The application chosen last time for this content type. */ lastChoice: string | undefined; /** The MIME type being opened. */ contentType: string | undefined; uri: string | undefined; /** The file's name, without its directory. */ filename: string | undefined; }; /** Which `FileChooser` method asked. */ export declare enum FileChooserMode { /** Existing files, or a folder when `directory` is set. */ Open = 0, /** One new path. */ Save = 1, /** A folder to save `files` into. */ SaveFiles = 2 } /** A named group of accepted extensions, such as "Images". */ export type FileChooserFilter = { /** Lowercase and without the dot; empty accepts any file. */ extensions: readonly string[]; name: string; }; /** * A question asked beside the files. No options means a checkbox, answered * `"true"` or `"false"`. */ export type FileChoice = { id: string; /** The option id, or `"true"`/`"false"`, selected at first. */ initial: string; label: string; options: readonly { id: string; label: string; }[]; }; /** A file chooser's request. Paths are absolute. */ export type FileChooserBody = { /** The confirm button's label; the shell's own when absent. */ acceptLabel: string | undefined; choices: readonly FileChoice[]; /** The index in `filters` to start with. */ currentFilter: number | undefined; /** The folder to start in; the home when absent. */ currentFolder: string | undefined; /** The suggested name for {@link FileChooserMode.Save}. */ currentName: string | undefined; /** Open a folder rather than a file. */ directory: boolean; /** The names {@link FileChooserMode.SaveFiles} saves into the folder. */ files: readonly string[]; /** Empty accepts any file. */ filters: readonly FileChooserFilter[]; /** The user's home directory, where the picker's places are. */ home: string; mode: FileChooserMode; multiple: boolean; title: string; }; /** What the user chose in a file chooser. */ export type FileChosen = { /** Each {@link FileChoice}'s answer, by id. */ choices: ReadonlyMap; /** The index in the request's `filters` in use. */ currentFilter: number | undefined; /** Absolute paths: the files, or the folder for `SaveFiles`. */ paths: readonly string[]; }; /** A session change an inhibitor holds off. */ export declare enum Inhibited { Logout = 0, UserSwitch = 1, Suspend = 2 } /** What an inhibitor holds off, and the application's reason. */ export type InhibitBody = { what: readonly Inhibited[]; reason: string | undefined; }; /** Input devices a session asks for or holds. */ export type Devices = { keyboard: boolean; pointer: boolean; touchscreen: boolean; }; /** What a remote desktop session asks to control. */ export type RemoteDesktopBody = { devices: Devices; clipboard: boolean; }; /** A window an agent may be let reach. */ export type AgentWindow = { /** Its `domicile list-windows` id. */ id: string; /** A browser window rather than a native one. */ browser: boolean; /** Empty when it has none. */ title: string; /** A native window's desktop entry id, or a browser window's app id. */ app: string | undefined; }; /** An agent's ask: its name, and the windows the user may pick from. */ export type AgentBody = { /** What the agent calls itself, such as "Claude Code". Not checked. */ agent: string; /** Every window open but private browser windows, which no agent reaches. */ windows: readonly AgentWindow[]; /** * What it reaches now, when the user asked to change it with * {@link PortalAnswer.Change}; canceling keeps it. `undefined` when it * asks to come in. */ current: AgentReach | undefined; /** Whether it comes in without asking now, so Remember starts on. */ remembered: boolean; }; /** What an agent may reach. */ export type AgentReach = /** Every window, the pointer and the keyboard. */ { kind: "desk"; } /** * These windows alone, through their accessibility trees and their own * screenshots. Never the pointer or the keyboard. */ | { kind: "windows"; windows: readonly AgentWindow[]; }; /** An agent let in now. */ export type ConnectedAgent = { /** Its {@link CapturingKind.Agent} session's id. */ session: number; agent: string; reach: AgentReach; }; /** An agent let reach the whole desk without asking, until forgotten. */ export type RememberedAgent = { agent: string; /** When it was last let in, in milliseconds since the Unix epoch. */ lastUsedMs: number; }; /** The agents the desk knows. */ export type KnownAgents = { /** Let in now, oldest first. */ connected: readonly ConnectedAgent[]; /** Let in without asking, most recently used first. */ remembered: readonly RememberedAgent[]; }; /** One thing an agent did, in its words. */ export type AgentAction = { said: string; /** When, in milliseconds since the Unix epoch, as `Date.now()` counts. */ atMs: number; }; /** An agent the user let in. */ export type AgentSessionBody = { agent: string; reach: AgentReach; /** What it did last, newest first; a handful at most. */ actions: readonly AgentAction[]; }; /** What an input capture session asks to take. */ export type InputCaptureBody = { devices: Devices; }; /** What an application would get of the user, and why it asks. */ export type AccountBody = { /** In the application's own words. */ reason: string | undefined; name: string; /** The picture's path, or `undefined` for none. */ image: string | undefined; }; /** A shortcut an application asks for. */ export type ProposedShortcut = { id: string; description: string; /** * The chord the user chose before, else the one the application prefers, * as it wrote it; it may not parse. Absent for neither. */ trigger: string | undefined; }; /** A global shortcuts review: the shortcuts, and chords other apps hold. */ export type ShortcutsBody = { shortcuts: readonly ProposedShortcut[]; taken: readonly { chord: string; appId: string; }[]; }; /** The chord the user chose for a shortcut; `undefined` clears it. */ export type ChosenTrigger = { id: string; trigger: string | undefined; }; /** A rectangle of a {@link FrozenDesk}'s frame, in its pixels. */ export type ShotRect = { x: number; y: number; width: number; height: number; }; /** A monitor of a {@link FrozenDesk}. */ export type ShotArea = { /** Its `wl_output` name. */ name: string; /** Its make, model and serial, or empty. */ description: string; area: ShotRect; }; /** * An open window of a {@link FrozenDesk}, shown or not. The shell finds a * shown one on the frame itself; one it does not show is saved from its own * last frame with {@link PortalAnswer.ScreenshotWindow}. */ export type ShotWindow = { /** Its host app id, as an ``'s `app-id` names it. */ id: string; /** Empty until the client names it. */ title: string; /** Its Wayland app id, which names its desktop entry; empty if unset. */ appId: string; }; /** * A frame of the whole desk, frozen while the user picks from it. Every * rectangle, and the answer, is in the frame's pixels. */ export type FrozenDesk = { /** The frame, as a `data:` URL. */ frame: string; width: number; height: number; monitors: readonly ShotArea[]; windows: readonly ShotWindow[]; /** * Where the frame is on the desktop, in logical pixels, which are the * shell page's CSS pixels. */ desk: { position: readonly [number, number]; size: readonly [number, number]; }; }; /** A chord an application holds, for the shell to grab. */ export type BoundShortcut = { /** The id a press is reported under. */ id: number; appId: string; chord: string; }; /** Where a Wallpaper portal picture goes. */ export declare enum WallpaperTarget { Background = 0, Lockscreen = 1, Both = 2 } /** A wallpaper preview: the picture, as a path to read, and where it goes. */ export type WallpaperBody = { path: string; setOn: WallpaperTarget; }; /** * The pictures applications set through the Wallpaper portal, as paths to read * with the SDK's `system`. `undefined` where none was set. */ export type PortalWallpaper = { background: string | undefined; lockscreen: string | undefined; }; /** What a launcher starts. */ export declare enum LauncherType { Application = 0, Webapp = 1 } /** A launcher install: its suggested name, icon and, for a web app, address. */ export type LauncherBody = { /** Whether the user may rename it. */ editableName: boolean; /** A `data:` URL; absent when the icon is no picture a page draws. */ icon: string | undefined; launcherType: LauncherType; name: string; /** A web app's address. */ target: string | undefined; }; /** One USB device, as udev names it. */ export type UsbDevice = { id: string; product: string | undefined; vendor: string | undefined; /** Whether the application would write to it. */ writable: boolean; }; /** The USB devices an application would open. */ export type UsbBody = { devices: readonly UsbDevice[]; }; export declare enum CastSourceKind { Window = 0, Monitor = 1, Region = 2, BrowserWindow = 3 } export declare const CastSource: { /** * A browser window's page alone, picked from `DomicileHost.browserWindows`. * The compositor does not list these; see {@link ScreenCastBody}. */ BrowserWindow: (window: { /** Its id, as `DomicileHost.browserWindows` lists it. */ id: string; /** Its title as the shell named it, for the sharing indicator. */ title: string; /** Part of its page alone, as a window's `area` is. */ area?: ShotRect | undefined; }) => { /** Its id, as `DomicileHost.browserWindows` lists it. */ id: string; /** Its title as the shell named it, for the sharing indicator. */ title: string; /** Part of its page alone, as a window's `area` is. */ area?: ShotRect | undefined; kind: CastSourceKind.BrowserWindow; }; Monitor: (monitor: { /** Its `wl_output` name, as `DomicileHost.displays` names it. */ name: string; /** Its make, model and serial, or empty. */ description: string; /** In page pixels. */ size: readonly [number, number]; }) => { /** Its `wl_output` name, as `DomicileHost.displays` names it. */ name: string; /** Its make, model and serial, or empty. */ description: string; /** In page pixels. */ size: readonly [number, number]; kind: CastSourceKind.Monitor; }; /** A rectangle of the desktop the user drew, in page pixels. */ Region: (region: { position: readonly [number, number]; size: readonly [number, number]; }) => { position: readonly [number, number]; size: readonly [number, number]; kind: CastSourceKind.Region; }; Window: (window: { /** The window's id, as `DomicileHost.windows` lists it. */ id: string; /** Empty until the client names it. */ title: string; /** Its Wayland app id, which names its desktop entry; empty if unset. */ appId: string; /** * Part of the window alone, in pixels of its frame as * `System.previewWindow` draws it. All of it when unset. */ area?: ShotRect | undefined; }) => { /** The window's id, as `DomicileHost.windows` lists it. */ id: string; /** Empty until the client names it. */ title: string; /** Its Wayland app id, which names its desktop entry; empty if unset. */ appId: string; /** * Part of the window alone, in pixels of its frame as * `System.previewWindow` draws it. All of it when unset. */ area?: ShotRect | undefined; kind: CastSourceKind.Window; }; }; /** One source a screen cast picker offers. */ export type CastSource = ReturnType<(typeof CastSource)[keyof typeof CastSource]>; /** A screen cast picker's choices. */ export type ScreenCastBody = { /** Whether the user may pick more than one source. */ multiple: boolean; /** Windows and monitors. */ sources: readonly CastSource[]; /** Whether the user may draw a region instead. */ region: boolean; /** * Whether the user may pick a browser window's page alone, which the * shell offers from `DomicileHost.browserWindows`. */ browserWindows: boolean; /** * A frame of the desk to preview the sources on, as a screenshot's. * `undefined` when the desk could not be shot. */ desk: FrozenDesk | undefined; }; export declare enum CapturedKind { Window = 0, Monitor = 1, Desk = 2, Region = 3, BrowserWindow = 4 } /** A monitor a screen cast records. */ export type CapturedMonitor = { /** Its `wl_output` name. */ name: string; /** Its make and model, or empty when it reports none. */ description: string; }; export declare const Captured: { /** A browser window's page, with its title when it was picked. */ BrowserWindow: (window: { id: string; title: string; }) => { id: string; title: string; kind: CapturedKind.BrowserWindow; }; /** A region that covers every monitor of a desktop with several. */ Desk: () => { kind: CapturedKind.Desk; }; /** A monitor, or a region that covers one exactly. */ Monitor: (monitor: CapturedMonitor) => { /** Its `wl_output` name. */ name: string; /** Its make and model, or empty when it reports none. */ description: string; kind: CapturedKind.Monitor; }; /** * A rectangle of the desktop, in page pixels, with the monitor it is mostly * on, or `undefined` when it is on none. */ Region: (region: { position: readonly [number, number]; size: readonly [number, number]; monitor: CapturedMonitor | undefined; }) => { position: readonly [number, number]; size: readonly [number, number]; monitor: CapturedMonitor | undefined; kind: CapturedKind.Region; }; /** * A window, with its title and its application's Wayland app id when the * cast started. The app id is empty when the window has none. */ Window: (window: { appId: string; id: string; title: string; }) => { appId: string; id: string; title: string; kind: CapturedKind.Window; }; }; /** One source a running screen cast records. */ export type Captured = ReturnType<(typeof Captured)[keyof typeof Captured]>; /** A {@link CapturingKind.Recording}: what it records, where, and for how long. */ export type RecordingBody = { sources: readonly Captured[]; /** The absolute path of the WebM it records into. */ file: string; /** How long it recorded until `runningSinceMs`, or until it paused. */ recordedMs: number; /** * When it last started or resumed, in milliseconds since the Unix epoch, as * `Date.now()` counts. Undefined while it is paused. */ runningSinceMs: number | undefined; }; /** IPP's `sides`. */ export declare enum Sides { OneSided = 0, /** Bound along the long edge, as a book. */ TwoSidedLongEdge = 1, /** Bound along the short edge, as a notepad. */ TwoSidedShortEdge = 2 } /** IPP's `print-color-mode`, as far as a dialog offers it. */ export declare enum ColorMode { Color = 0, Monochrome = 1 } /** IPP's `orientation-requested`. */ export declare enum Orientation { Portrait = 0, Landscape = 1, ReverseLandscape = 2, ReversePortrait = 3 } /** IPP's `print-quality`. */ export declare enum PrintQuality { Draft = 0, Normal = 1, High = 2 } /** Pages `first` to `last`, counted from 1, both included. */ export type PageRange = { first: number; last: number; }; /** A print job's options. An absent option is the printer's default. */ export type PrintOptions = { colorMode: ColorMode | undefined; /** At least 1. */ copies: number; /** A {@link PrintMedia} `name`. */ media: string | undefined; orientation: Orientation | undefined; /** Empty prints every page. */ pages: readonly PageRange[]; quality: PrintQuality | undefined; sides: Sides | undefined; }; /** A paper size: its PWG name, and a label for people. */ export type PrintMedia = { label: string; name: string; }; /** A printer and what it supports. An empty list offers no choice. */ export type Printer = { colorModes: readonly ColorMode[]; copiesMax: number; /** For people. */ description: string | undefined; /** What the dialog starts with for this printer. */ initial: PrintOptions; media: readonly PrintMedia[]; /** The CUPS queue name. */ name: string; orientations: readonly Orientation[]; /** Whether it prints only some pages. */ pageRanges: boolean; qualities: readonly PrintQuality[]; sides: readonly Sides[]; }; /** A print dialog: the document's title, the printers on offer and Save to PDF. */ export type PrintBody = { /** The print button's label; the shell's own when absent. */ acceptLabel: string | undefined; /** The user's home directory, where the PDF's file picker starts. */ home: string; /** What Save to PDF offers, as a printer would. Its `name` is no CUPS queue. */ pdf: Printer; /** The printer to start with. */ printer: string | undefined; /** Empty when CUPS has none or cannot be reached. */ printers: readonly Printer[]; title: string; }; export declare const PortalRequest: { Access: (base: PortalRequestBase, body: AccessBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: AccessBody; kind: PortalKind.Access; }; Account: (base: PortalRequestBase, body: AccountBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: AccountBody; kind: PortalKind.Account; }; Agent: (base: PortalRequestBase, body: AgentBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: AgentBody; kind: PortalKind.Agent; }; AppChooser: (base: PortalRequestBase, body: AppChooserBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: AppChooserBody; kind: PortalKind.AppChooser; }; DynamicLauncher: (base: PortalRequestBase, body: LauncherBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: LauncherBody; kind: PortalKind.DynamicLauncher; }; FileChooser: (base: PortalRequestBase, body: FileChooserBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: FileChooserBody; kind: PortalKind.FileChooser; }; GlobalShortcuts: (base: PortalRequestBase, body: ShortcutsBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: ShortcutsBody; kind: PortalKind.GlobalShortcuts; }; Inhibit: (base: PortalRequestBase, body: InhibitBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: InhibitBody; kind: PortalKind.Inhibit; }; InputCapture: (base: PortalRequestBase, body: InputCaptureBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: InputCaptureBody; kind: PortalKind.InputCapture; }; PickColor: (base: PortalRequestBase, body: FrozenDesk) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: FrozenDesk; kind: PortalKind.PickColor; }; Print: (base: PortalRequestBase, body: PrintBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: PrintBody; kind: PortalKind.Print; }; RemoteDesktop: (base: PortalRequestBase, body: RemoteDesktopBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: RemoteDesktopBody; kind: PortalKind.RemoteDesktop; }; ScreenCast: (base: PortalRequestBase, body: ScreenCastBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: ScreenCastBody; kind: PortalKind.ScreenCast; }; Screenshot: (base: PortalRequestBase, body: FrozenDesk) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: FrozenDesk; kind: PortalKind.Screenshot; }; Unknown: (base: PortalRequestBase, wireKind: string) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; kind: PortalKind.Unknown; wireKind: string; }; Usb: (base: PortalRequestBase, body: UsbBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: UsbBody; kind: PortalKind.Usb; }; Wallpaper: (base: PortalRequestBase, body: WallpaperBody) => { /** The id {@link answerPortalRequest} takes. */ id: number; /** The asking application's desktop file id. Empty when unknown. */ appId: string; /** The `` to show the dialog over, or the focused screen when absent. */ parentAppId: string | undefined; body: WallpaperBody; kind: PortalKind.Wallpaper; }; }; export type PortalRequest = ReturnType<(typeof PortalRequest)[keyof typeof PortalRequest]>; export declare enum PortalAnswerKind { /** * The user allowed an {@link PortalKind.Access} or * {@link PortalKind.Account} request. */ Access = 0, /** The application the user picked in an {@link PortalKind.AppChooser}. */ AppChooser = 1, /** The user chose in a {@link PortalKind.FileChooser}. */ FileChooser = 2, /** The user granted a {@link PortalKind.RemoteDesktop} no more than it asked. */ RemoteDesktop = 3, /** The user allowed a {@link PortalKind.InputCapture} request. */ InputCapture = 4, /** The user picked sources in a {@link PortalKind.ScreenCast} request. */ ScreenCast = 5, /** The user stopped a {@link Capturing} session. */ Stop = 6, /** The user paused a {@link CapturingKind.Recording}. */ Pause = 7, /** The user resumed a paused {@link CapturingKind.Recording}. */ Resume = 8, /** The user stopped a {@link CapturingKind.Recording} and threw it away. */ Discard = 9, /** The chords the user chose in a {@link PortalKind.GlobalShortcuts} review. */ GlobalShortcuts = 10, /** The name the user installs a {@link PortalKind.DynamicLauncher} under. */ DynamicLauncher = 11, /** The printer and options the user chose in a {@link PortalKind.Print}. */ Print = 12, /** The file a {@link PortalKind.Print} saves its PDF to, and its options. */ SaveToPdf = 13, /** The area of a {@link PortalKind.Screenshot} the user kept. */ Screenshot = 14, /** * The window of a {@link PortalKind.Screenshot} the user picked, saved from * its own last frame. */ ScreenshotWindow = 15, /** * A browser window of a {@link PortalKind.Screenshot} the user picked, saved * from the engine's capture of its page alone. */ ScreenshotBrowserWindow = 16, /** The pixel of a {@link PortalKind.PickColor} the user picked. */ PickColor = 17, /** What the user lets a {@link PortalKind.Agent} reach. */ Agent = 18, /** The user asked to change what a {@link CapturingKind.Agent} reaches. */ Change = 19, /** The user dismissed or denied the dialog. */ Canceled = 20, /** The shell has no dialog for this kind. */ Refused = 21 } export declare const PortalAnswer: { Access: () => { kind: PortalAnswerKind.Access; }; /** * Windows must be ones the request offered, and at least one. `remember` * lets the agent in without asking next time, and takes the whole desk. */ Agent: (reach: AgentReach, remember?: boolean) => { kind: PortalAnswerKind.Agent; reach: AgentReach; remember: boolean; }; /** `choice` must be one of the request's `choices`. */ AppChooser: (choice: string) => { choice: string; kind: PortalAnswerKind.AppChooser; }; Canceled: () => { kind: PortalAnswerKind.Canceled; }; /** Asks the user again what the agent session with this id reaches. */ Change: () => { kind: PortalAnswerKind.Change; }; Discard: () => { kind: PortalAnswerKind.Discard; }; /** Not empty; the request's own name unless `editableName`. */ DynamicLauncher: (name: string) => { kind: PortalAnswerKind.DynamicLauncher; name: string; }; FileChooser: (chosen: FileChosen) => { chosen: FileChosen; kind: PortalAnswerKind.FileChooser; }; GlobalShortcuts: (triggers: readonly ChosenTrigger[]) => { kind: PortalAnswerKind.GlobalShortcuts; triggers: readonly ChosenTrigger[]; }; InputCapture: () => { kind: PortalAnswerKind.InputCapture; }; Pause: () => { kind: PortalAnswerKind.Pause; }; /** A pixel inside the request's frame. */ PickColor: (at: { x: number; y: number; }) => { at: { x: number; y: number; }; kind: PortalAnswerKind.PickColor; }; /** `printer` must be one of the request's `printers`. */ Print: (printer: string, options: PrintOptions) => { kind: PortalAnswerKind.Print; options: PrintOptions; printer: string; }; Refused: () => { kind: PortalAnswerKind.Refused; }; RemoteDesktop: (devices: Devices, clipboard: boolean) => { clipboard: boolean; devices: Devices; kind: PortalAnswerKind.RemoteDesktop; }; Resume: () => { kind: PortalAnswerKind.Resume; }; /** An absolute `path`; `options` within the request's `pdf`. */ SaveToPdf: (path: string, options: PrintOptions) => { kind: PortalAnswerKind.SaveToPdf; options: PrintOptions; path: string; }; ScreenCast: (sources: readonly CastSource[]) => { kind: PortalAnswerKind.ScreenCast; sources: readonly CastSource[]; }; /** * A non-empty area inside the request's frame. `copy` also puts it on the * clipboard; the shell's own screenshot is then not saved. */ Screenshot: (area: ShotRect, copy: boolean) => { area: ShotRect; copy: boolean; kind: PortalAnswerKind.Screenshot; }; /** * A browser window, by its `DomicileBrowserWindow` id; `copy` as above. * Nothing the shell draws over the window is in the shot. */ ScreenshotBrowserWindow: (id: string, copy: boolean, area?: ShotRect | undefined) => { area: ShotRect | undefined; copy: boolean; id: string; kind: PortalAnswerKind.ScreenshotBrowserWindow; }; /** * One of the request's windows, by {@link ShotWindow.id}; `copy` as above. * `area` is part of it, in pixels of its frame as `System.previewWindow` * draws it; all of it when unset. */ ScreenshotWindow: (id: string, copy: boolean, area?: ShotRect | undefined) => { area: ShotRect | undefined; copy: boolean; id: string; kind: PortalAnswerKind.ScreenshotWindow; }; Stop: () => { kind: PortalAnswerKind.Stop; }; }; export type PortalAnswer = ReturnType<(typeof PortalAnswer)[keyof typeof PortalAnswer]>; export declare enum CapturingKind { /** An application controls input, and the clipboard when `clipboard` is set. */ RemoteDesktop = 0, /** An application takes the user's input once it crosses a screen edge. */ InputCapture = 1, /** An application records windows, monitors or a region. */ ScreenCast = 2, /** * The shell's own screen recording, which `System.screenRecord` started. * Paused, resumed and discarded as well as stopped. */ Recording = 3, /** An agent the user let see and use the desk. */ Agent = 4, /** A kind this SDK cannot parse. It can still be stopped. */ Unknown = 5 } /** What every capturing session carries. */ export type CapturingBase = { /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; }; export declare const Capturing: { Agent: (base: CapturingBase, body: AgentSessionBody) => { agent: string; reach: AgentReach; /** What it did last, newest first; a handful at most. */ actions: readonly AgentAction[]; /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; kind: CapturingKind.Agent; }; InputCapture: (base: CapturingBase, body: InputCaptureBody) => { devices: Devices; /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; kind: CapturingKind.InputCapture; }; Recording: (base: CapturingBase, body: RecordingBody) => { sources: readonly Captured[]; /** The absolute path of the WebM it records into. */ file: string; /** How long it recorded until `runningSinceMs`, or until it paused. */ recordedMs: number; /** * When it last started or resumed, in milliseconds since the Unix epoch, as * `Date.now()` counts. Undefined while it is paused. */ runningSinceMs: number | undefined; /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; kind: CapturingKind.Recording; }; RemoteDesktop: (base: CapturingBase, body: RemoteDesktopBody) => { devices: Devices; clipboard: boolean; /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; kind: CapturingKind.RemoteDesktop; }; ScreenCast: (base: CapturingBase, body: { sources: readonly Captured[]; }) => { /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; sources: readonly Captured[]; kind: CapturingKind.ScreenCast; }; Unknown: (base: CapturingBase, wireKind: string) => { /** The id {@link stopCapturing} takes. */ id: number; /** The application's desktop file id. Empty when unknown. */ appId: string; kind: CapturingKind.Unknown; wireKind: string; }; }; export type Capturing = ReturnType<(typeof Capturing)[keyof typeof Capturing]>; /** Element Capture's `RestrictionTarget`, which TypeScript's DOM lacks. */ type RestrictionTargets = { fromElement: (element: Element) => Promise; }; /** * Leave `element` out of every capture of the desk: screen recordings, screen * casts and screenshots. It still shows on screen. For the shell's page only; * see `docs/PORTALS.md#screen-recording`. * * The element must be a stacking context and its own group, such as with * `isolation: isolate`, or Element Capture ignores it. `targets` is * `RestrictionTarget`, absent in an engine without Element Capture, where this * does nothing. */ export declare const hideFromCaptures: (element: Element, targets?: RestrictionTargets | undefined) => Promise; export {};