Skip to main content

Crate rightkit_tauri_shell

Crate rightkit_tauri_shell 

Source
Expand description

rightkit-tauri-shell: the shared Tauri desktop shell for Right Suite apps.

What every desktop app needs around its own UI: a hardened webview, window state, a native menu, a tray, single instance, deep links, autostart, a rich clipboard, a hang watchdog and the window-to-engine seam. Layout is NOT part of the shell (the sidebar/titlebar layout lives in @rightkit/react-shell, optional and replaceable); this crate is the behaviour underneath.

ⓘ
tauri::Builder::default()
    .plugin(rightkit_tauri_shell::Shell::builder("myapp").app_name("MyApp").tray(spec).build().plugin())
    .invoke_handler(rightkit_tauri_shell::handler![my_app_command])
    .run(tauri::generate_context!())

See API.md for per-app migration.

Re-exports§

pub use autostart::AutostartMigration;
pub use autostart::AutostartOptions;
pub use autostart::LegacyAutostartNames;
pub use broker::PathBroker;
pub use clipboard::ClipboardItem;
pub use clipboard::ClipboardOptions;
pub use clipboard::ClipboardPolicy;
pub use clipboard::ImagePreference;
pub use devtools::ContentWebview;
pub use devtools::DevToolsError;
pub use devtools::DevToolsGate;
pub use devtools::DevToolsPolicy;
pub use devtools::WebviewDecision;
pub use error::ShellError;
pub use harden::Hardening;
pub use harden::HardeningScript;
pub use idle::IdleErrorCallback;
pub use idle::IdleFailure;
pub use idle::IdlePhase;
pub use idle::IdleTransition;
pub use idle::IdleTransitionCallback;
pub use idle::IdleTransitionKind;
pub use menu::MenuEntry;
pub use menu::MenuGroup;
pub use menu::MenuSpec;
pub use modules::Module;
pub use modules::ModuleSet;
pub use modules::ShellPlugin;
pub use modules::ShellPluginBuilder;
pub use nav::NavDecision;
pub use nav::NavPolicy;
pub use opener::ExternalOpener;
pub use opener::SystemOpener;
pub use presence::AutoPrefs;
pub use presence::PresenceState;
pub use recovery::MigrationOutcome;
pub use recovery::RecoverySpec;
pub use single_instance::ClaimFailure;
pub use single_instance::ClaimOptions;
pub use single_instance::ClaimOutcome;
pub use single_instance::InstanceMessage;
pub use single_instance::LegacySingleInstanceNames;
pub use single_instance::SingleInstance;
pub use single_instance::SingleInstanceGuard;
pub use site::SitePolicy;
pub use stream::StreamEvent;
pub use stream::StreamEventKind;
pub use stream::StreamObserver;
pub use stream::StreamPolicy;
pub use tray::LeftClick;
pub use tray::TraySpec;
pub use watchdog::ShellRuntimeStatus;
pub use watchdog::StallReport;
pub use watchdog::WatchdogConfig;
pub use watchdog::WatchdogStatus;

Modules§

autostart
Launch at login. Base: CodeRight os_shell/autostart (Linux XDG .desktop, Windows HKCU Run through reg.exe with no console), plus the macOS LaunchAgent the donor lacked (HeardRight’s login_launch covered it only for its own bundle). The login launch receives AutostartOptions::args (default --background), so it never starts a second engine.
b64
Minimal standard base64 for moving binary clipboard payloads across the JSON IPC boundary.
broker
Path broker: the renderer never names a file the user did not hand to the app.
clipboard
Rich clipboard: text, HTML, PNG image, file lists and app-defined formats, in one transaction, plus a typed “what did the person copy” contract for paste and open-from-clipboard.
commands
Tauri commands the frontend bridge (@rightkit/tauri-shell) calls. Register them with crate::handler!. They are application commands, so they need no ACL capability entry.
deep_link
Deep links / URL schemes: validation, a queue that waits for the frontend, and registration.
devtools
DevTools policy: every Right app has no access to DevTools; ViewRight alone may inspect the HTML content it opens.
error
Typed error envelope for shell commands that need category handling in the renderer.
frameless
Frameless window chrome. macOS keeps the native traffic lights over an overlay title bar; Windows/Linux drop decorations and the app draws its own title bar (the @rightkit/react-shell TitleBar) using the rk_shell_window controls and data-tauri-drag-region.
harden
Webview hardening: no stray webview context menu, reload / zoom / history keys blocked, drag-drop cannot navigate, external links leave for the system browser.
idle
Webview idle / resource management for tray-resident apps.
instance
Single-instance arbitration over rightkit-daemon (no extra plugin, no lock file).
lifecycle
Startup / shutdown order and RunEvent routing.
menu
Native application menu: standard App / Edit / View / Window / Help structure, no browser verbs (no Reload, no zoom, no Back), plus app-defined groups.
modules
Modular install: opt individual shell modules out, or install only the state the broker, stream, recovery, frameless and clipboard commands need.
nav
Navigation and window-open policy: what a webview may load in place, what leaves for the system browser, and what is refused.
notify
Native notifications, badge and sound policy.
open_url
Standalone “open URL” hook: usable without the full Shell plugin.
opener
System handler for external links. Arguments are passed as argv (never through a shell) and only schemes allowed by crate::nav::external_scheme_allowed reach it.
presence
Presentation-aware presence and Do-Not-Disturb.
quit
Opt-in quit drain.
recovery
Setup recovery: a crash-safe session snapshot.
single_instance
Standalone single instance with a typed message, usable without the shell plugin.
site
Site-root serving: a second custom scheme (<app>-site://) that serves allowlisted subresources beneath a granted site root.
startup_cache
Startup cache repair: keep the app’s cache directory usable before a plugin needs it.
stream
Ranged custom-protocol streaming of broker-granted files.
tray
System tray / menu-bar extra with a dynamic menu.
watchdog
Main-thread hang watchdog.
window_state
DPI-independent window geometry persistence and restore.
windows
Window creation and lifecycle helpers: hardened builders, reveal / toggle, secondary windows.

Macros§

handler
Build the invoke_handler with the shell commands plus the app’s own. rightkit_tauri_shell::handler![my_command, other].

Structs§

Shell
ShellBuilder
ShellState
Everything the shell shares at runtime (managed Tauri state).

Enums§

CloseBehavior
What closing the main window does.

Constants§

EVENT_DEEP_LINK
EVENT_ENGINE
EVENT_IDLE
EVENT_MENU
EVENT_PRESENCE
EVENT_QUIT_REQUESTED
Emitted instead of exiting when the host opted into ShellBuilder::quit_drain.
EVENT_SECOND_INSTANCE
EVENT_STALL
EVENT_TRAY
EVENT_WINDOW

Type Aliases§

SecondInstanceCallback
Called on the first instance when a later launch forwards its argv and working directory.