mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[WIP] Support tray in menu manager
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package menu
|
||||
|
||||
// Tray are the options
|
||||
type Tray struct {
|
||||
|
||||
// The ID of this tray
|
||||
ID string
|
||||
// TrayMenu are the options
|
||||
type TrayMenu struct {
|
||||
|
||||
// Label is the text we wish to display in the tray
|
||||
Label string
|
||||
|
||||
@@ -9,6 +9,6 @@ type Options struct {
|
||||
WebviewIsTransparent bool
|
||||
WindowBackgroundIsTranslucent bool
|
||||
Menu *menu.Menu
|
||||
Tray *menu.Tray
|
||||
TrayMenus []*menu.TrayMenu
|
||||
ContextMenus *menu.ContextMenus
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type App struct {
|
||||
DevTools bool
|
||||
RGBA int
|
||||
ContextMenus *menu.ContextMenus
|
||||
Tray *menu.Tray
|
||||
TrayMenus []*menu.TrayMenu
|
||||
Menu *menu.Menu
|
||||
Mac *mac.Options
|
||||
Logger logger.Logger `json:"-"`
|
||||
@@ -41,25 +41,25 @@ func MergeDefaults(appoptions *App) {
|
||||
|
||||
}
|
||||
|
||||
func GetTray(appoptions *App) *menu.Tray {
|
||||
var result *menu.Tray
|
||||
func GetTrayMenus(appoptions *App) []*menu.TrayMenu {
|
||||
var result []*menu.TrayMenu
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
if appoptions.Mac != nil {
|
||||
result = appoptions.Mac.Tray
|
||||
result = appoptions.Mac.TrayMenus
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.Tray
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
//case "windows":
|
||||
// if appoptions.Windows != nil {
|
||||
// result = appoptions.Windows.Tray
|
||||
// result = appoptions.Windows.TrayMenu
|
||||
// }
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
result = appoptions.Tray
|
||||
result = appoptions.TrayMenus
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -74,11 +74,11 @@ func GetApplicationMenu(appoptions *App) *menu.Menu {
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.Tray
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
//case "windows":
|
||||
// if appoptions.Windows != nil {
|
||||
// result = appoptions.Windows.Tray
|
||||
// result = appoptions.Windows.TrayMenu
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -101,11 +101,11 @@ func GetContextMenus(appoptions *App) *menu.ContextMenus {
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.Tray
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
//case "windows":
|
||||
// if appoptions.Windows != nil {
|
||||
// result = appoptions.Windows.Tray
|
||||
// result = appoptions.Windows.TrayMenu
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user