Adds the entries of a menu to the menu of the Dock icon of the app.
Synopsis
ztk::mac::dockmenu ?MENU?
Arguments
| Name |
Type |
Default |
Meaning |
MENU |
menu widget |
empty |
The menu. The system shows its entries above the items of macOS. An empty string, or no argument, removes the menu. |
Return value
An empty string.
Errors
| Error |
When |
ztk::mac::dockmenu is only on macOS |
A backend other than macOS. The error code is ZTK MAC UNAVAILABLE. |
bad window path name "W" |
No widget has the name. |
"W" is not a menu |
The widget is not a menu. |
wrong # args: should be "ztk::mac::dockmenu ?menu?" |
More than one argument. |
| Platform |
Works |
| Windows |
No: ZTK MAC UNAVAILABLE |
| macOS |
Yes |
| Linux, Wayland |
No: ZTK MAC UNAVAILABLE |
| Linux, X11 |
No: ZTK MAC UNAVAILABLE |
| Web |
No: ZTK MAC UNAVAILABLE |
| iOS, Android |
No: ZTK MAC UNAVAILABLE |
| Headless |
No: ZTK MAC UNAVAILABLE |
Example
if {[ztk::has mac]} {
menu .dock -tearoff 0
.dock add command -label "New window" -command {puts new}
ztk::mac::dockmenu .dock
}
See also