ExTauri.OS (ex_tauri v0.2.0)
View SourceQuery OS information from your LiveView.
Bridges to tauri-plugin-os via the LiveView hook.
Requirements
tauri-plugin-osmust be installed (see Plugin Setup below)- The
TauriHookmust be mounted in your LiveView (seeExTauri.Hook)
Plugin Setup
mix ex_tauri.add osThis adds the Cargo dependency, registers the plugin in main.rs, and adds
the os:default capability. See Mix.Tasks.ExTauri.Add for details.
Examples
# Request OS info
def handle_event("get_os_info", _params, socket) do
socket = ExTauri.OS.info(socket)
{:noreply, socket}
end
# Handle the response
def handle_event("tauri_response", %{"command" => "os_info"} = params, socket) do
os_info = %{
platform: params["platform"],
arch: params["arch"],
version: params["version"],
os_type: params["os_type"],
locale: params["locale"]
}
{:noreply, assign(socket, :os_info, os_info)}
end
Summary
Functions
Requests OS information from the Tauri runtime.