import { VSBuffer } from "../../../base/common/buffer.js"; import { Event } from "../../../base/common/event.js"; import { URI } from "../../../base/common/uri.js"; import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from "../../../base/parts/sandbox/common/electronTypes.js"; import { ISerializableCommandAction } from "../../action/common/action.js"; import { INativeOpenDialogOptions } from "../../dialogs/common/dialogs.js"; import { IV8Profile } from "../../profiling/common/profiling.js"; import { AuthInfo, Credentials } from "../../request/common/request.js"; import { IPartsSplash } from "../../theme/common/themeService.js"; import { IColorScheme, IOpenedAuxiliaryWindow, IOpenedMainWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPoint, IRectangle, IWindowOpenable } from "../../window/common/window.js"; export interface IToastOptions { readonly id: string; readonly title: string; readonly body?: string; readonly actions?: readonly string[]; readonly silent?: boolean; } export interface IToastResult { readonly supported: boolean; readonly clicked: boolean; readonly actionIndex?: number; } export interface ICPUProperties { model: string; speed: number; } export interface IOSProperties { type: string; release: string; arch: string; platform: string; cpus: ICPUProperties[]; } export interface IOSStatistics { totalmem: number; freemem: number; loadavg: number[]; } export interface INativeHostOptions { readonly targetWindowId?: number; } export declare enum FocusMode { /** * (Default) Transfer focus to the target window * when the editor is focused. */ Transfer = 0, /** * Transfer focus to the target window when the * editor is focused, otherwise notify the user that * the app has activity (macOS/Windows only). */ Notify = 1, /** * Force the window to be focused, even if the editor * is not currently focused. */ Force = 2 } export interface ICommonNativeHostService { readonly _serviceBrand: undefined; readonly windowId: number; readonly onDidOpenMainWindow: Event; readonly onDidMaximizeWindow: Event; readonly onDidUnmaximizeWindow: Event; readonly onDidFocusMainWindow: Event; readonly onDidBlurMainWindow: Event; readonly onDidChangeWindowFullScreen: Event<{ windowId: number; fullscreen: boolean; }>; readonly onDidChangeWindowAlwaysOnTop: Event<{ windowId: number; alwaysOnTop: boolean; }>; readonly onDidFocusMainOrAuxiliaryWindow: Event; readonly onDidBlurMainOrAuxiliaryWindow: Event; readonly onDidChangeDisplay: Event; readonly onDidSuspendOS: Event; readonly onDidResumeOS: Event; readonly onDidChangeOnBatteryPower: Event; readonly onDidChangeThermalState: Event; readonly onDidChangeSpeedLimit: Event; readonly onWillShutdownOS: Event; readonly onDidLockScreen: Event; readonly onDidUnlockScreen: Event; readonly onDidChangeColorScheme: Event; readonly onDidChangePassword: Event<{ readonly service: string; readonly account: string; }>; readonly onDidTriggerWindowSystemContextMenu: Event<{ readonly windowId: number; readonly x: number; readonly y: number; }>; getWindows(options: { includeAuxiliaryWindows: true; }): Promise>; getWindows(options: { includeAuxiliaryWindows: false; }): Promise>; getWindowCount(): Promise; getActiveWindowId(): Promise; getActiveWindowPosition(): Promise; getNativeWindowHandle(windowId: number): Promise; openWindow(options?: IOpenEmptyWindowOptions): Promise; openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; openSessionsWindow(): Promise; isFullScreen(options?: INativeHostOptions): Promise; toggleFullScreen(options?: INativeHostOptions): Promise; getCursorScreenPoint(): Promise<{ readonly point: IPoint; readonly display: IRectangle; }>; isMaximized(options?: INativeHostOptions): Promise; maximizeWindow(options?: INativeHostOptions): Promise; unmaximizeWindow(options?: INativeHostOptions): Promise; minimizeWindow(options?: INativeHostOptions): Promise; moveWindowTop(options?: INativeHostOptions): Promise; positionWindow(position: IRectangle, options?: INativeHostOptions): Promise; isWindowAlwaysOnTop(options?: INativeHostOptions): Promise; toggleWindowAlwaysOnTop(options?: INativeHostOptions): Promise; setWindowAlwaysOnTop(alwaysOnTop: boolean, options?: INativeHostOptions): Promise; updateWindowControls(options: INativeHostOptions & { height?: number; backgroundColor?: string; foregroundColor?: string; dimmed?: boolean; }): Promise; updateWindowAccentColor(color: "default" | "off" | string, inactiveColor: string | undefined): Promise; setMinimumSize(width: number | undefined, height: number | undefined): Promise; saveWindowSplash(splash: IPartsSplash): Promise; setBackgroundThrottling(allowed: boolean): Promise; /** * Make the window focused. * @param options specify the specific window to focus and the focus mode. * Defaults to {@link FocusMode.Transfer}. */ focusWindow(options?: INativeHostOptions & { mode?: FocusMode; }): Promise; showMessageBox(options: MessageBoxOptions & INativeHostOptions): Promise; showSaveDialog(options: SaveDialogOptions & INativeHostOptions): Promise; showOpenDialog(options: OpenDialogOptions & INativeHostOptions): Promise; pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise; pickFileAndOpen(options: INativeOpenDialogOptions): Promise; pickFolderAndOpen(options: INativeOpenDialogOptions): Promise; pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise; showItemInFolder(path: string): Promise; setRepresentedFilename(path: string, options?: INativeHostOptions): Promise; setDocumentEdited(edited: boolean, options?: INativeHostOptions): Promise; openExternal(url: string, defaultApplication?: string): Promise; moveItemToTrash(fullPath: string): Promise; isAdmin(): Promise; writeElevated(source: URI, target: URI, options?: { unlock?: boolean; }): Promise; isRunningUnderARM64Translation(): Promise; getOSProperties(): Promise; getOSStatistics(): Promise; getOSVirtualMachineHint(): Promise; getOSColorScheme(): Promise; hasWSLFeatureInstalled(): Promise; getScreenshot(rect?: IRectangle): Promise; getProcessId(): Promise; killProcess(pid: number, code: string): Promise; triggerPaste(options?: INativeHostOptions): Promise; readClipboardText(type?: "selection" | "clipboard"): Promise; writeClipboardText(text: string, type?: "selection" | "clipboard"): Promise; readClipboardFindText(): Promise; writeClipboardFindText(text: string): Promise; writeClipboardBuffer(format: string, buffer: VSBuffer, type?: "selection" | "clipboard"): Promise; readClipboardBuffer(format: string): Promise; hasClipboard(format: string, type?: "selection" | "clipboard"): Promise; readImage(): Promise; newWindowTab(): Promise; showPreviousWindowTab(): Promise; showNextWindowTab(): Promise; moveWindowTabToNewWindow(): Promise; mergeAllWindowTabs(): Promise; toggleWindowTabsBar(): Promise; updateTouchBar(items: ISerializableCommandAction[][]): Promise; installShellCommand(): Promise; uninstallShellCommand(): Promise; notifyReady(): Promise; relaunch(options?: { addArgs?: string[]; removeArgs?: string[]; }): Promise; reload(options?: { disableExtensions?: boolean; }): Promise; closeWindow(options?: INativeHostOptions): Promise; quit(): Promise; exit(code: number): Promise; openDevTools(options?: Partial & INativeHostOptions): Promise; toggleDevTools(options?: INativeHostOptions): Promise; openGPUInfoWindow(): Promise; openDevToolsWindow(url: string): Promise; openContentTracingWindow(): Promise; stopTracing(): Promise; profileRenderer(session: string, duration: number): Promise; resolveProxy(url: string): Promise; lookupAuthorization(authInfo: AuthInfo): Promise; lookupKerberosAuthorization(url: string): Promise; loadCertificates(): Promise; isPortFree(port: number): Promise; findFreePort(startPort: number, giveUpAfter: number, timeout: number, stride?: number): Promise; windowsGetStringRegKey(hive: "HKEY_CURRENT_USER" | "HKEY_LOCAL_MACHINE" | "HKEY_CLASSES_ROOT" | "HKEY_USERS" | "HKEY_CURRENT_CONFIG", path: string, name: string): Promise; showToast(options: IToastOptions): Promise; clearToast(id: string): Promise; clearToasts(): Promise; /** * Creates a zip file at the specified path containing the provided files. * * @param zipPath The URI where the zip file should be created. * @param files An array of file entries to include in the zip, each with a relative path and string contents. */ createZipFile(zipPath: URI, files: { path: string; contents: string; }[]): Promise; getSystemIdleState(idleThreshold: number): Promise; getSystemIdleTime(): Promise; getCurrentThermalState(): Promise; isOnBatteryPower(): Promise; startPowerSaveBlocker(type: PowerSaveBlockerType): Promise; stopPowerSaveBlocker(id: number): Promise; isPowerSaveBlockerStarted(id: number): Promise; } /** * Represents the system's idle state. */ export type SystemIdleState = "active" | "idle" | "locked" | "unknown"; /** * Represents the system's thermal state. */ export type ThermalState = "unknown" | "nominal" | "fair" | "serious" | "critical"; /** * The type of power save blocker. */ export type PowerSaveBlockerType = "prevent-app-suspension" | "prevent-display-sleep";