veko doc
Self-Contained API Reference • Gradual Types • Capabilities • Wasm Sandbox

ui/shell_win

lib/ui/shell_win.vk

lib/ui/shell_win.vk Win32 Desktop Shell integration (Slice 2): System Tray, Notifications, Canvas->HICON, & Global Hotkeys. - Zero top-level mut globals: all tray state, hotkeys, and simulated records live inside ShellState. - Calls ffi/* builtins directly inside local helpers (no use [ffi]) so apps stay under .ui. - Deterministic headless simulator mode when sh.headless is true, VEKO_HEADLESS=1, or non-Windows.

signature
ShortcutSpec = struct { chord str, mods i64, vk i64, hk_id i64 = ..., label str = ... }
signature
TrayMenuItem = struct { label str, action any = ..., divider bool = ..., cmd_id i64 = ... }
TrayHandle struct
signature
TrayHandle = struct { active bool = ..., uid i64 = ..., hwnd i64 = ..., hicon i64 = ..., owns_icon bool = ..., tooltip str = ..., menu_items block = ..., click_action any = ... }
signature
NotificationRecord = struct { title str, body str, tone enum = ... }
ShellState struct
signature
ShellState = struct { headless bool = ..., tray TrayHandle = ..., shortcuts map = ..., id_to_chord map = ..., next_hk_id i64 = ..., sim_notifications block = ..., sim_events block = ... }
signature
parse-shortcut-chord = fn [chord str] any

Parses a chord string (e.g. 'Ctrl+Shift+K') into a Win32 ShortcutSpec or err.

canvas-to-hicon fn caps: .ffi
signature
canvas-to-hicon = fn [canvas_any any] i64

Converts an RGBA32 Canvas struct or { width, height, pixels } map into a Win32 HICON (or 0).

signature
tray-create = fn [mut sh ShellState, hwnd i64, tooltip str, icon_canvas any, menu_items block, click_action any] bool

Creates a system tray icon (or updates sh.tray in headless simulator mode).

signature
tray-update = fn [mut sh ShellState, tooltip str, icon_canvas any, menu_items block] bool

Updates the active tray icon tooltip, icon surface, and context menu items.

tray-show-menu fn caps: .ffi
signature
tray-show-menu = fn [sh ShellState, hwnd i64] map

Displays the tray popup menu at the cursor and returns { label, action, cmd_id } or {}.

signature
tray-remove = fn [mut sh ShellState]

Removes the active system tray icon and destroys any owned HICON.

signature
shell-notify = fn [mut sh ShellState, hwnd i64, title str, body str, tone enum] bool

Dispatches a desktop balloon notification and records it in sh.sim_notifications.

register-shortcut fn caps: .ffi
signature
register-shortcut = fn [mut sh ShellState, hwnd i64, chord str] any

Registers a global Win32 hotkey from a chord string and stores it in sh.

unregister-shortcut fn caps: .ffi
signature
unregister-shortcut = fn [mut sh ShellState, hwnd i64, chord str] bool

Unregisters a previously registered global hotkey by chord string.

signature
decode-hotkey-id = fn [sh ShellState, hk_id i64] str

Maps a WM_HOTKEY identifier back to its registered chord string (or '').

signature
shutdown-shell = fn [mut sh ShellState, hwnd i64]

Unregisters all global shortcuts and removes any active system tray icon.