wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
24.46k stars 1.17k forks source link

[v3] Systemtray window open on left side #3717

Closed skowrons closed 2 weeks ago

skowrons commented 2 weeks ago

Description

We created the app with wails3 init and added the following code:

package main

import (
    "embed"
    "log"

    "github.com/wailsapp/wails/v3/pkg/application"
)

//go:embed frontend/dist
var assets embed.FS

func main() {
    app := application.New(application.Options{
        Name:        "system-tray-test",
        Description: "",
        Services: []application.Service{
            application.NewService(&GreetService{}),
        },
        Assets: application.AssetOptions{
            Handler: application.AssetFileServerFS(assets),
        },
        Mac: application.MacOptions{
            ApplicationShouldTerminateAfterLastWindowClosed: false,
        },
    })

    window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
        Title: "Window",
        Mac: application.MacWindow{
            InvisibleTitleBarHeight: 50,
            Backdrop:                application.MacBackdropTranslucent,
            TitleBar:                application.MacTitleBarHiddenInset,
        },
        BackgroundColour: application.NewRGB(27, 38, 54),
        URL:              "/",
    })

    tray := app.NewSystemTray()
    tray.SetLabel("Window")
    tray.AttachWindow(window)

    err := app.Run()
    if err != nil {
        log.Fatal(err)
    }
}

When clicking on Window it will open/close the window on the left side of the screen and not below the icon. Is this expected behaviour? Because we do not see any way to get the position of the system tray label/icon to imperatively set the window position.

To Reproduce

  1. Run wails3 init
  2. Add go code to main.go as described above
  3. Click Window in system tray
  4. Window will be shown on the left most positin

Expected behaviour

Window should be show below the system tray icon/label.

Screenshots

No response

Attempted Fixes

No response

System Details

Wails Doctor

# System
┌──────────────────────────────────────────────────────────┐
| Name          | MacOS                                    |
| Version       | 14.6.1                                   |
| ID            | 23G93                                    |
| Branding      | Sonoma                                   |
| Platform      | darwin                                   |
| Architecture  | amd64                                    |
| Apple Silicon | unknown                                  |
| CPU           | Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz |
| CPU           | Unknown                                  |
| GPU           | Unknown                                  |
| Memory        | Unknown                                  |
└──────────────────────────────────────────────────────────┘

# Build Environment
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.6                                                                                                            |
| Go Version     | go1.23.0                                                                                                                  |
| -buildmode     | exe                                                                                                                       |
| -compiler      | gc                                                                                                                        |
| CGO_CFLAGS     |                                                                                                                           |
| CGO_CPPFLAGS   |                                                                                                                           |
| CGO_CXXFLAGS   |                                                                                                                           |
| CGO_ENABLED    | 1                                                                                                                         |
| CGO_LDFLAGS    |                                                                                                                           |
| DefaultGODEBUG | asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1 |
| GOAMD64        | v1                                                                                                                        |
| GOARCH         | amd64                                                                                                                     |
| GOOS           | darwin                                                                                                                    |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2408                                                 |
| npm             | 8.15.0                                               |
| *NSIS           | Not Installed. Install with `brew install makensis`. |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs

 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

No response

leaanthony commented 2 weeks ago

Hi there! Thanks for this feedback. Whilst v3 is in alpha, we have a strict feedback procedure outlined here: https://v3alpha.wails.io/getting-started/feedback This is to reduce noise whilst the branch is unstable and keep all the information in one place. We'd love to have you as part of the v3 feedback loop so please consider opening a new post there. Just a copy and paste would be fine. Closing this for now. Thanks again 🙏