tauri-system-tray_skill

This skill helps you implement and manage Tauri system tray icons, menus, events, and runtime updates to enhance app accessibility.

12

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill dchuk/claude-code-tauri-skills --skill tauri-system-tray

  • SKILL.md13.7 KB

Overview

This skill guides you through implementing a system tray (notification area) for Tauri v2 apps. It covers enabling the feature, creating a tray icon and menu, handling icon and menu events, and updating the tray (icon, tooltip, and menu) at runtime. Examples and platform notes are included to avoid common pitfalls.

How this skill works

The skill shows how to enable the tray-icon feature in Cargo.toml and create a TrayIcon with TrayIconBuilder in src-tauri. It demonstrates building menus (items, separators, submenus), attaching event handlers for menu selections and mouse events, and exposing commands to update the tray icon, tooltip, and menu dynamically. A complete example ties state management, event handling, and commands together for runtime changes.

When to use it

  • Add a persistent app presence in the OS notification area (background utilities, agents).
  • Provide quick access to common actions without opening the main window (show/hide, quit, pause).
  • Expose runtime state and controls (toggle features, reflect connection status).
  • React to user clicks and double-clicks on the tray icon to control app visibility or behavior.
  • Dynamically change menu items or icon/tooltip to reflect app state.

Best practices

  • Enable tauri = { features = ["tray-icon"] } in src-tauri/Cargo.toml before using tray APIs.
  • Use TrayIconBuilder::with_id(...) to reference and update the tray later via app.tray_by_id().
  • Attach on_menu_event and on_tray_icon_event before calling build() so handlers are active.
  • Keep GUI-affecting logic (show/hide/focus) concise and handle missing windows with option checks.
  • Store menus or relevant state in tauri::manage(...) when you need to update items or replace the menu at runtime.
  • Test mouse and menu behavior on target OSes; Linux lacks Enter/Move/Leave events.

Example use cases

  • Background downloader with tray controls: pause/resume, show status, quit.
  • Chat or presence app: show connection status, reconnect or disconnect from the tray.
  • System utility: single-click to toggle main window, right-click menu for preferences and quit.
  • Monitoring agent: update tooltip/icon to reflect health or alerts; replace menu when state changes.
  • App that stays headless: start at login and expose tray interactions only.

FAQ

Ensure the tray-icon feature is enabled, the icon path is valid, and you call build() and keep the result. Also confirm the OS supports tray icons in your environment.

How do I change the tray icon or tooltip at runtime?

Create tauri commands that call app.tray_by_id("your-id").set_icon(...) or set_tooltip(...). Use Image::from_path for icon data and return errors as strings.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational