mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[V3 Alpha] Improves macOS Window menu support (#4588)
* feat: Binds window menu to app windows * chore: disables tab feature & controls from menu by default * docs: Adds title to example for it to show in the window menu item * style: removes redundant SetBackgroundColor call * chore: rolls back disabling tab controls for a future optional config * docs: adds change description to unreleased notes --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
parent
ff6a333621
commit
335fa0bcc5
3 changed files with 14 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ After processing, the content will be moved to the main changelog and this file
|
|||
|
||||
## Added
|
||||
<!-- New features, capabilities, or enhancements -->
|
||||
- macOS: Shows native window controls in the menu bar in [#4588](https://github.com/wailsapp/wails/pull/4588) by @nidib
|
||||
- Add macOS Dock service to hide/show app icon in the dock @popaprozac in [PR](https://github.com/wailsapp/wails/pull/4451)
|
||||
|
||||
## Changed
|
||||
|
|
|
|||
|
|
@ -146,7 +146,10 @@ func main() {
|
|||
|
||||
app.Menu.Set(menu)
|
||||
|
||||
window := app.Window.New().SetBackgroundColour(application.NewRGB(33, 37, 41))
|
||||
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
|
||||
Name: "menu-example",
|
||||
Title: "Menu Example",
|
||||
}).SetBackgroundColour(application.NewRGB(33, 37, 41))
|
||||
window.SetMenu(menu)
|
||||
|
||||
err := app.Run()
|
||||
|
|
|
|||
|
|
@ -53,6 +53,12 @@ static void addServicesMenu(void* menu) {
|
|||
[NSApp setServicesMenu:nsMenu];
|
||||
}
|
||||
|
||||
// Add windows menu
|
||||
void addWindowsMenu(void* menu) {
|
||||
NSMenu *nsMenu = (__bridge NSMenu *)menu;
|
||||
[NSApp setWindowsMenu:nsMenu];
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
|
@ -96,6 +102,9 @@ func (m *macosMenu) processMenu(parent unsafe.Pointer, menu *Menu) {
|
|||
if item.role == ServicesMenu {
|
||||
C.addServicesMenu(nsSubmenu)
|
||||
}
|
||||
if item.role == WindowMenu {
|
||||
C.addWindowsMenu(nsSubmenu)
|
||||
}
|
||||
case text, checkbox, radio:
|
||||
menuItem := newMenuItemImpl(item)
|
||||
item.impl = menuItem
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue