mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-24 19:25:12 +03:00
7fb419c326
Co-authored-by: Lucas Nogueira <lucas@tauri.studio> Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2.1 KiB
2.1 KiB
tauri |
---|
major:breaking |
The tray icon and menu have received a huge refactor with a lot of breaking changes in order to add new functionalities and improve the DX around using them and here is an overview of the changes:
- All menu and tray types are now exported from
tauri::menu
andtauri::tray
modules with new names so make sure to check the new types. - Removed
tauri::Builder::system_tray
, instead you should usetauri::tray::TrayIconBuilder
insidetauri::Builder::setup
hook to create your tray icons. - Changed
tauri::Builder::menu
to be a function to accomodate for new menu changes, you can passetauri::menu::Menu::default
to it to create a default menu. - Renamed
tauri::Context
methodssystem_tray_icon
,tauri::Context::system_tray_icon_mut
andtauri::Context::set_system_tray_icon
totauri::Context::tray_icon
,tauri::Context::tray_icon_mut
andtauri::Context::set_tray_icon
to be consistent with new type names. - Added
RunEvent::MenuEvent
andRunEvent::TrayIconEvent
. - Added
App/AppHandle::set_menu
,App/AppHandle::remove_menu
,App/AppHandle::show_menu
,App/AppHandle::hide_menu
andApp/AppHandle::menu
to access, remove, hide or show the app-wide menu that is used as the global menu on macOS and on all windows that don't have a specific menu set for it on Windows and Linux. - Added
Window::set_menu
,Window::remove_menu
,Window::show_menu
,Window::hide_menu
,Window::is_menu_visible
andWindow::menu
to access, remove, hide or show the menu on this window. - Added
Window::popup_menu
andWindow::popup_menu_at
to show a context menu on the window at the cursor position or at a specific position. You can also popup a context menu usingpopup
andpopup_at
methods fromContextMenu
trait which is implemented forMenu
andSubmenu
types. - Added
App/AppHandle::tray
,App/AppHandle::tray_by_id
,App/AppHandle::remove_tray
andApp/AppHandle::remove_tray_by_id
to access or remove a registered tray. - Added
WindowBuilder/App/AppHandle::on_menu_event
to register a new menu event handler. - Added
App/AppHandle::on_tray_icon_event
to register a new tray event handler.