pub enum DesktopCommand {
Show 17 variants
OpenWindow(Box<OpenWindow>),
SetAttributes(Box<WindowAttributes>),
Request(WindowRequest),
Quit,
Restart,
SetQuitMode(QuitMode),
SetQuitOnRequest(bool),
SetQuitRequestOptions(QuitRequestOptions),
CancelQuitRequest,
SetMenu(Option<Arc<[MenuItem]>>),
SetMenuBar(MenuBarMode),
PerformMenuRole(MenuRole),
SetMenuLabels(Box<MenuLabels>),
PopupMenu {
items: Arc<[MenuItem]>,
at: Option<Point<Points>>,
},
SetTray(Option<Tray>),
RegisterGlobalShortcut {
id: u32,
shortcut: Shortcut,
},
UnregisterGlobalShortcut(u32),
}Expand description
A desktop command, on a window’s root node (the root for the main window and what is the app’s: menus, the tray, global shortcuts).
Variants§
OpenWindow(Box<OpenWindow>)
Shows the dialog root the command is addressed to in a window of its own, until the node is removed. Sent before the node is inserted; a platform without windows of its own ignores it (the runtime does not send it there).
SetAttributes(Box<WindowAttributes>)
The window’s attributes that changed since the last commit (the fields set; one command per window and commit).
Request(WindowRequest)
A request to the window.
Quit
Quits the app, as its quit menu role does: the app ends without a
per-window close path, also when closing the window would leave it
running (a window kept hidden, a tray icon). A view embedded in
another app leaves the app’s lifecycle to that app.
Restart
Quits the app as DesktopCommand::Quit does, then starts it again
with the same arguments once this process has exited
([crate::restart]). A view embedded in another app leaves the
app’s lifecycle to that app: nothing happens there.
SetQuitMode(QuitMode)
When the app quits if its last window closes (the mode
Application.setQuitMode sets; "platform" defaults to it on
Windows and Linux, not macOS). The core sends
DesktopCommand::Quit on the root when the last window goes and
the mode quits there.
SetQuitOnRequest(bool)
Whether the user’s quit requests quit the app: its Quit item and
the platform’s quit key (Command-Q, Ctrl+Q). false while the app
listens to them (crate::element::desktop::on_quit_request): the
platform reports them on the root (WindowEvent::QuitRequest)
instead, and the app sends DesktopCommand::Quit when it is
ready. The system ending the app quits either way by default;
macOS and Windows can include it with
DesktopCommand::SetQuitRequestOptions.
Sent when it changes; true until the first. On the
web, while it is false, the user leaving the page is the request.
SetQuitRequestOptions(QuitRequestOptions)
Sets the additional quit request sources (macOS; system on
Windows and, with a session manager, Linux too). Both default to false. Other platforms ignore this
command.
CancelQuitRequest
Cancels a pending quit request on macOS, Windows and Linux, including the system’s logout or shutdown. Nothing happens without a pending request.
SetMenu(Option<Arc<[MenuItem]>>)
The application menu (macOS’s menu bar, the window’s menu bar on
Windows and Linux; not shown there while the title bar is hidden,
its shortcuts still work); None restores the platform’s default.
SetMenuBar(MenuBarMode)
When the menu bar the window draws for the application menu shows.
PerformMenuRole(MenuRole)
Performs a menu role as the application menu’s item of that role
does (Menu.perform): an edit role acts on the focused view, a
window role on the focused window. For menus the app draws itself.
SetMenuLabels(Box<MenuLabels>)
The core translated the labels of NSH’s menus for the language the app shows. Native backends update their menus at once.
PopupMenu
Shows a context menu at at (root coordinates, points) or at the
pointer.
SetTray(Option<Tray>)
Shows the app’s icon in the system tray (the notification area on
Windows, the menu bar’s status items on macOS, a StatusNotifierItem
on Linux), or changes it; None removes it. One per app: the last
window’s wins.
RegisterGlobalShortcut
Registers shortcut system-wide, whichever app has the keyboard: the
root’s crate::EventKind::Menu reports id with registered
(whether the system took it), then id alone at each press.
UnregisterGlobalShortcut(u32)
Gives back the global shortcut registered as id.