import { VSBuffer } from "../../../../base/common/buffer.js"; import { CancellationToken } from "../../../../base/common/cancellation.js"; import { Event } from "../../../../base/common/event.js"; import { FocusMode } from "../../../../platform/native/common/native.js"; import { IOpenEmptyWindowOptions, IWindowOpenable, IOpenWindowOptions, IPoint, IRectangle, IOpenedMainWindow, IOpenedAuxiliaryWindow } from "../../../../platform/window/common/window.js"; import { IToastOptions, IToastResult } from "./host.js"; export declare const IHostService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; /** * A set of methods supported in both web and native environments. * * @see {@link INativeHostService} for methods that are specific to native * environments. */ export interface IHostService { readonly _serviceBrand: undefined; /** * Emitted when the focus of the window changes. * * Note: this considers the main window as well as auxiliary windows * when they are in focus. As long as the main window or any of its * auxiliary windows have focus, this event fires with `true`. It will * fire with `false` when neither the main window nor any of its * auxiliary windows have focus. */ readonly onDidChangeFocus: Event; /** * Find out if the window or any of its auxiliary windows have focus. */ readonly hasFocus: boolean; /** * Find out if the window had the last focus. */ hadLastFocus(): Promise; /** * Attempt to bring the window to the foreground and focus it. * * @param options How to focus the window, defaults to {@link FocusMode.Transfer} */ focus(targetWindow: Window, options?: { mode?: FocusMode; }): Promise; /** * Emitted when the active window changes between main window * and auxiliary windows. */ readonly onDidChangeActiveWindow: Event; /** * Emitted when the window with the given identifier changes * its fullscreen state. */ readonly onDidChangeFullScreen: Event<{ windowId: number; fullscreen: boolean; }>; /** * Opens an empty window. The optional parameter allows to define if * a new window should open or the existing one change to an empty. */ openWindow(options?: IOpenEmptyWindowOptions): Promise; /** * Opens the provided array of openables in a window with the provided options. */ openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; /** * Switch between fullscreen and normal window. */ toggleFullScreen(targetWindow: Window): Promise; /** * Bring a window to the front and restore it if needed. */ moveTop(targetWindow: Window): Promise; /** * Toggle dimming of window control overlays (e.g. when showing * a modal dialog or modal editor part). */ setWindowDimmed(targetWindow: Window, dimmed: boolean): Promise; /** * Get the location of the mouse cursor and its display bounds or `undefined` if unavailable. */ getCursorScreenPoint(): Promise<{ readonly point: IPoint; readonly display: IRectangle; } | undefined>; /** * Get the list of opened windows, optionally including auxiliary windows. */ getWindows(options: { includeAuxiliaryWindows: true; }): Promise>; getWindows(options: { includeAuxiliaryWindows: false; }): Promise>; /** * Restart the entire application. */ restart(): Promise; /** * Reload the currently active main window. */ reload(options?: { disableExtensions?: boolean; }): Promise; /** * Attempt to close the active main window. */ close(): Promise; /** * Execute an asynchronous `expectedShutdownTask`. While this task is * in progress, attempts to quit the application will not be vetoed with a dialog. */ withExpectedShutdown(expectedShutdownTask: () => Promise): Promise; /** * Captures a screenshot. */ getScreenshot(rect?: IRectangle): Promise; /** * Get the native handle of the window. */ getNativeWindowHandle(windowId: number): Promise; /** * Show an OS-level toast notification. */ showToast(options: IToastOptions, token: CancellationToken): Promise; }