import type { Result } from "@cprussin/option-result"; /** Why a system call failed, as the compositor said. */ export declare enum SystemErrorKind { NotFound = 0, PermissionDenied = 1, AlreadyExists = 2, NotADirectory = 3, IsADirectory = 4, /** Bad data, an empty argv, or an id already running: a bug in the caller. */ InvalidInput = 5, /** The desktop is locked. See docs/LOCK.md. */ Locked = 6, /** A D-Bus method returned an error; the message starts with its name. */ Dbus = 7, /** The user dismissed the dialog the call put up. */ Canceled = 8, /** * The compositor exited with the call open. A watch or other {@link * Listening} never ends this way: it listens again under the next * compositor. See "A compositor restart" in docs/architecture/ENGINE-FORK.md. */ CompositorGone = 9, Other = 10 } /** Why the lock did not take a passphrase. See docs/LOCK.md. */ export declare enum UnlockRefusal { /** The compositor checked it, and it is wrong. */ WrongPassphrase = 0, /** The compositor could not check it, such as a PAM module missing. */ Unverifiable = 1, /** Sent during the wait after repeated refused passphrases, so not checked. */ TooSoon = 2 } /** A passphrase the lock did not take. */ export type UnlockRefused = { refusal: UnlockRefusal; /** Refused passphrases, wrong or unverifiable, since the desktop last opened. */ failures: number; /** How long the compositor refuses every passphrase, unchecked. */ retryInMs: number; }; export type SystemError = { kind: SystemErrorKind; /** The operating system's description, for logs. */ message: string; }; export declare enum FileType { File = 0, Directory = 1, Symlink = 2, /** A device, socket or pipe. */ Other = 3 } export type DirEntry = { name: string; /** The entry's own type: a symlink is not followed. */ fileType: FileType; }; export type Stat = { /** What the path is, following symlinks. */ fileType: FileType; /** In bytes. Files under `/sys` and `/proc` report 0 or 4096. */ size: number; modifiedMs: number | undefined; /** * The absolute path with every link resolved, so two paths to one file * compare equal; `undefined` from a host too old to say. */ realPath: string | undefined; }; export declare enum Signal { Hup = 0, Int = 1, Term = 2, Kill = 3, Usr1 = 4, Usr2 = 5 } export type SpawnOptions = { /** Where it runs; the home by default. Relative paths start at the home. */ cwd?: string; /** Added to the desktop's environment. */ env?: Readonly>; /** Whether {@link Subprocess.write} can reach it; `/dev/null` otherwise. */ stdin?: boolean; }; /** How a process ended: its exit code, or the signal that killed it. */ export type Exit = { code: number | undefined; signal: number | undefined; }; export type Subprocess = { stdout: ReadableStream; stderr: ReadableStream; /** Settles after all of its output. */ exited: Promise>; write: (data: Uint8Array | string) => void; closeStdin: () => void; /** Signals its process group: {@link Signal.Term} by default. */ kill: (signal?: Signal) => void; }; export declare enum Bus { Session = 0, System = 1 } /** * A D-Bus method call. `body` holds one JSON value per complete type in * `signature`, written as `domicile_host::dbus_json` describes: `v` is * `{ signature, value }`, `a{KV}` an object, structures and arrays arrays. */ export type DbusCall = { bus: Bus; destination: string; path: string; interface: string; member: string; /** Empty, the default, for no arguments. */ signature?: string; body?: readonly unknown[]; }; /** A D-Bus body: what a method returned, or a signal carried. */ export type DbusBody = { signature: string; /** Untyped: parse it with a schema for the signature you expect. */ body: unknown[]; }; /** The signals to report: those matching every field given. */ export type DbusMatch = { bus: Bus; sender?: string; path?: string; interface?: string; member?: string; }; export type DbusSignal = DbusBody & { sender: string; path: string; interface: string; member: string; }; export type Listening = { /** Closes when it ends. */ items: ReadableStream; stop: () => void; /** `Ok` after {@link Listening.stop}, `Err` if it broke. */ ended: Promise>; }; /** What a watch or a D-Bus match heard. */ export declare enum ListenedKind { /** A change or a signal. */ Heard = 0, /** * The compositor restarted, and the call was sent again for the next one. * Changes in between were not heard: read again what the items told you. */ Missed = 1 } export declare const Listened: { Heard: (item: T) => { item: T; kind: ListenedKind.Heard; }; Missed: () => { kind: ListenedKind.Missed; }; }; export type Listened = ReturnType> | ReturnType; /** Part of a file: from `offset` (0 by default), `length` bytes or to the end. */ export type ByteRange = { offset?: number; length?: number; }; /** What {@link System.run} collected. */ export type Ran = Exit & { stdout: string; stderr: string; }; /** Where a screenshot from the shell's dialog went. */ export declare enum ScreenshotKeptKind { /** Saved under `$XDG_PICTURES_DIR/Screenshots/`. */ Saved = 0, /** Copied to the clipboard with Ctrl+C, and not saved. */ Copied = 1 } export declare const ScreenshotKept: { Copied: () => { kind: ScreenshotKeptKind.Copied; }; /** Saved as the PNG at `path`. */ Saved: (path: string) => { kind: ScreenshotKeptKind.Saved; path: string; }; }; export type ScreenshotKept = ReturnType<(typeof ScreenshotKept)[keyof typeof ScreenshotKept]>; /** A watch's `items` hear the absolute path of each change. */ export type Watch = Listening>; /** A monitor for {@link System.addVirtualMonitor} to add. */ export type VirtualMonitorMode = { /** Its description, such as the TV it is cast to. */ name: string; width: number; height: number; refreshMhz: number; /** * Device pixels per logical pixel, such as 1.5: windows on it draw that * much finer. 1 when left out. Must be above zero. */ scale?: number; }; /** A monitor with no connector, which the desk extends onto. */ export type VirtualMonitor = { /** Its `wl_output` name, as `domicile.displays` names it. */ output: string; /** * Resize it in place: it keeps its `wl_output`, its windows and its casts. * Allowed while the desktop is locked. */ resize: (mode: Omit) => void; remove: () => void; /** * `Ok` after {@link VirtualMonitor.remove}. `Err` when it went with its * compositor; the next one does not have it. */ ended: Promise>; };