mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
Support Window aliases
This commit is contained in:
parent
bf8e541221
commit
ddb2f63f7b
4 changed files with 12 additions and 2 deletions
2
exp/.gitignore
vendored
2
exp/.gitignore
vendored
|
|
@ -1,2 +1,2 @@
|
|||
examples/basic/basic
|
||||
examples/kitchensink/kitchensink
|
||||
cmd/wails/wails
|
||||
|
|
@ -22,7 +22,8 @@ type App struct {
|
|||
options *options.Application
|
||||
applicationEventListeners map[uint][]func()
|
||||
|
||||
windows map[uint]*Window
|
||||
windows map[uint]*Window
|
||||
windowAliases map[string]uint
|
||||
|
||||
// Running
|
||||
running bool
|
||||
|
|
@ -47,6 +48,12 @@ func (a *App) NewWindow(options *options.Window) *Window {
|
|||
a.windows = make(map[uint]*Window)
|
||||
}
|
||||
a.windows[id] = newWindow
|
||||
if options.Alias != "" {
|
||||
if a.windowAliases == nil {
|
||||
a.windowAliases = make(map[string]uint)
|
||||
}
|
||||
a.windowAliases[options.Alias] = id
|
||||
}
|
||||
if a.running {
|
||||
newWindow.Run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ func getWindowID() uint {
|
|||
}
|
||||
|
||||
func NewWindow(options *options.Window) *Window {
|
||||
|
||||
return &Window{
|
||||
id: getWindowID(),
|
||||
options: options,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ const (
|
|||
)
|
||||
|
||||
type Window struct {
|
||||
// Alias is a human-readable name for the window. This can be used to reference the window in the frontend.
|
||||
Alias string
|
||||
Title string
|
||||
Width, Height int
|
||||
AlwaysOnTop bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue