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

ui/gtk

lib/ui/gtk.vk

lib/ui/gtk.vk Tier-3 Linux GTK4 / libadwaita platform extension module (ui/gtk). - Linux & Wayland detection, libgtk-4 / libadwaita runtime probing - Adwaita color-scheme code mapping & live style manager updates, dark theme detection - GTK4 CSS class management, application CSS provider loading, AdwWindowTitle headerbar - Strict-validated URI launching (http://, https://, mailto:) - Zero top-level mut globals; runs under allow-caps = [.ui] via direct ffi/* builtins - Deterministic headless fallback when VEKO_HEADLESS=1 / 'true' or on non-Linux hosts

is-linux? fn caps: .env .fs
signature
is-linux? = fn [] bool

Returns true when running on a Linux host (neither Windows nor macOS AppKit).

is-wayland? fn caps: .env
signature
is-wayland? = fn [] bool

Returns true when WAYLAND_DISPLAY is set in the environment.

signature
has-gtk4? = fn [] bool

Returns true if libgtk-4.so.1 can be opened on a live Linux host (false if headless/non-Linux).

signature
has-libadwaita? = fn [] bool

Returns true if libadwaita-1.so.0 can be opened on a live Linux host (false if headless/non-Linux).

signature
color-scheme-code = fn [scheme enum] i64

Maps Veko color-scheme enum to AdwColorScheme integer code (-1 if unrecognized).

set-color-scheme fn caps: .ffi
signature
set-color-scheme = fn [scheme enum] bool

Sets the Adwaita AdwStyleManager color scheme (true in headless mode for valid schemes).

is-linux-dark-theme? fn caps: .env .ffi
signature
is-linux-dark-theme? = fn [] bool

Queries ADW_STYLE_DARK, GTK_THEME, or adw_style_manager_get_dark (returns true when headless).

signature
add-css-class = fn [widget i64, cls str] bool

Adds a validated CSS class name to a GTK4 widget (true in headless mode for valid class names).

signature
remove-css-class = fn [widget i64, cls str] bool

Removes a validated CSS class name from a GTK4 widget (true in headless mode for valid class names).

load-app-css fn caps: .ffi
signature
load-app-css = fn [css str] bool

Loads an application-level GTK4 CSS stylesheet (priority = 600) onto the default GDK display.

set-headerbar-title fn caps: .ffi
signature
set-headerbar-title = fn [header_bar i64, title str, subtitle str] bool

Sets an AdwHeaderBar title widget using adw_window_title_new(title, subtitle).

open-uri fn caps: .ffi
signature
open-uri = fn [url str] bool

Opens url via GIO / GTK4 URI launcher after strict scheme (http://, https://, mailto:) and control-char checks.