Expand description
NativeHost atoms - native OS-layer handlers.
One pub async fn per file. This mod.rs only declares sub-modules; no
pub use. Dispatch-site callers bring each atom in via local use.
Modules§
- Find
Free Port - Wire method:
nativeHost:findFreePort. Scans 100 ports starting fromArguments[0](default 9000) and returns the first free one. Returns 0 when nothing is free in-range so callers can distinguish “search exhausted” from a genuine port 0. - GetColor
Scheme - Wire method:
nativeHost:getColorScheme. Returns{ dark, highContrast }. Dark-mode probe covers macOSAppleInterfaceStyle, WindowsAppsUseLightTheme, and a Linux ladder (GTK color-scheme → GTK theme name →KDE_COLOR_SCHEME→ xfconf). High-contrast probe is WindowsHighContrast/Flagsand the GNOME a11yhigh-contrastkey; other OSes return false. - IsFullscreen
- Wire method:
nativeHost:isFullscreen. Returns true if themainwebview window is fullscreen. Missing window returns false - this is a read-only probe and should not error. - IsMaximized
- Wire method:
nativeHost:isMaximized. Returns true if themainwebview window is maximized. Missing window returns false (matches VS Code’s behaviour on orphaned calls). - OSProperties
- Wire method:
nativeHost:getOSProperties(cross-platform). Returns Electron-shaped{ type, release, arch, platform, cpus }tuple so VS Code’sospolyfill can continue using the same surface. - OSStatistics
- Wire method:
nativeHost:getOSStatistics. Returns Electron-shaped{ totalmem, freemem, loadavg }snapshot.loadavgis the Unix triple; on Windows it’s[0,0,0]by policy so the caller gets a well-formed array. - Open
External - Wire method:
native:openExternal,nativeHost:openExternal. Opens an http/https URL in the platform default browser. - Pick
Folder - Wire method:
nativeHost:pickFolderAndOpen,:pickFileAndOpen,:pickFileFolderAndOpen,:pickWorkspaceAndOpen. - Show
Item InFolder - Wire method:
native:showItemInFolder,nativeHost:showItemInFolder. Reveals a path in the platform file manager (Finder / Explorer / Linux FM). - Show
Open Dialog - Wire method:
nativeHost:showOpenDialog.