ui/shell_win
lib/ui/shell_win.vklib/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.
ShortcutSpec = struct { chord str, mods i64, vk i64, hk_id i64 = ..., label str = ... }
TrayMenuItem = struct { label str, action any = ..., divider bool = ..., cmd_id i64 = ... }
TrayHandle = struct { active bool = ..., uid i64 = ..., hwnd i64 = ..., hicon i64 = ..., owns_icon bool = ..., tooltip str = ..., menu_items block = ..., click_action any = ... }
NotificationRecord = struct { title str, body str, tone enum = ... }
ShellState = struct { headless bool = ..., tray TrayHandle = ..., shortcuts map = ..., id_to_chord map = ..., next_hk_id i64 = ..., sim_notifications block = ..., sim_events block = ... }
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 [canvas_any any] i64
Converts an RGBA32 Canvas struct or { width, height, pixels } map into a Win32 HICON (or 0).
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).
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-remove = fn [mut sh ShellState]
Removes the active system tray icon and destroys any owned HICON.
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 [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 [mut sh ShellState, hwnd i64, chord str] bool
Unregisters a previously registered global hotkey by chord string.
decode-hotkey-id = fn [sh ShellState, hk_id i64] str
Maps a WM_HOTKEY identifier back to its registered chord string (or '').
shutdown-shell = fn [mut sh ShellState, hwnd i64]
Unregisters all global shortcuts and removes any active system tray icon.