SwitchTrayIcon

Function SwitchTrayIcon 

Source
pub fn SwitchTrayIcon(App: AppHandle, IsDarkMode: bool)
Expand description

Dynamically switches the tray icon based on the theme (Light/Dark). Can be invoked from the frontend when the theme changes.

§Parameters

  • App: Tauri application handle
  • IsDarkMode: Whether dark mode is active

§Behavior

  • Loads the appropriate icon bytes from embedded resources
  • Updates the tray icon with the new image
  • Logs errors if icon loading or setting fails

§Errors

  • Logs warnings/errors but doesn’t panic:
    • If tray with ID ‘tray’ not found
    • If icon bytes fail to load
    • If setting the new icon fails