mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
Support ProgramName on linux
This commit is contained in:
parent
4ab6352504
commit
98aff7778e
5 changed files with 29 additions and 59 deletions
|
|
@ -12,8 +12,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY
|
|||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
|
||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
|
|
@ -111,8 +111,7 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
|||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
|
|
@ -128,8 +127,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
|||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
@ -153,16 +151,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
|
|
|||
|
|
@ -186,6 +186,11 @@ func newPlatformApp(parent *App) *linuxApp {
|
|||
application: appNew(name),
|
||||
windowMap: map[windowPointer]uint{},
|
||||
}
|
||||
|
||||
if parent.options.Linux.ProgramName != "" {
|
||||
setProgramName(parent.options.Linux.ProgramName)
|
||||
}
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,6 @@ import (
|
|||
"github.com/wailsapp/wails/v3/internal/assetserver"
|
||||
)
|
||||
|
||||
// ActivationPolicy is the activation policy for the application.
|
||||
type ActivationPolicy int
|
||||
|
||||
const (
|
||||
// ActivationPolicyRegular is used for applications that have a user interface,
|
||||
ActivationPolicyRegular ActivationPolicy = iota
|
||||
// ActivationPolicyAccessory is used for applications that do not have a main window,
|
||||
// such as system tray applications or background applications.
|
||||
ActivationPolicyAccessory
|
||||
ActivationPolicyProhibited
|
||||
)
|
||||
|
||||
// Options contains the options for the application
|
||||
type Options struct {
|
||||
// Name is the name of the application (used in the default about box)
|
||||
|
|
@ -32,39 +20,13 @@ type Options struct {
|
|||
Icon []byte
|
||||
|
||||
// Mac is the Mac specific configuration for Mac builds
|
||||
Mac struct {
|
||||
// ActivationPolicy is the activation policy for the application. Defaults to
|
||||
// applicationActivationPolicyRegular.
|
||||
ActivationPolicy ActivationPolicy
|
||||
// If set to true, the application will terminate when the last window is closed.
|
||||
ApplicationShouldTerminateAfterLastWindowClosed bool
|
||||
}
|
||||
Mac MacOptions
|
||||
|
||||
// Windows is the Windows specific configuration for Windows builds
|
||||
Windows struct {
|
||||
|
||||
// WndProcInterceptor is a function that will be called for every message sent in the application.
|
||||
// Use this to hook into the main message loop. This is useful for handling custom window messages.
|
||||
// If `shouldReturn` is `true` then `returnCode` will be returned by the main message loop.
|
||||
// If `shouldReturn` is `false` then returnCode will be ignored and the message will be processed by the main message loop.
|
||||
WndProcInterceptor func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (returnCode uintptr, shouldReturn bool)
|
||||
|
||||
// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
|
||||
DisableQuitOnLastWindowClosed bool
|
||||
|
||||
// Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used.
|
||||
// If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code.
|
||||
WebviewUserDataPath string
|
||||
|
||||
// Path to the directory with WebView2 executables. If empty WebView2 installed in the system will be used.
|
||||
WebviewBrowserPath string
|
||||
}
|
||||
Windows WindowsOptions
|
||||
|
||||
// Linux is the Linux specific configuration for Linux builds
|
||||
Linux struct {
|
||||
// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
|
||||
DisableQuitOnLastWindowClosed bool
|
||||
}
|
||||
Linux LinuxOptions
|
||||
|
||||
// Bind allows you to bind Go methods to the frontend.
|
||||
Bind []any
|
||||
|
|
@ -214,4 +176,13 @@ type WindowsOptions struct {
|
|||
type LinuxOptions struct {
|
||||
// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
|
||||
DisableQuitOnLastWindowClosed bool
|
||||
|
||||
// ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname().
|
||||
//This name should not be localized. [see the docs]
|
||||
//
|
||||
//When a .desktop file is created this value helps with window grouping and desktop icons when the .desktop file's Name
|
||||
//property differs form the executable's filename.
|
||||
//
|
||||
//[see the docs]: https://docs.gtk.org/glib/func.set_prgname.html
|
||||
ProgramName string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,12 @@ func appNew(name string) pointer {
|
|||
return pointer(C.gtk_application_new(nameC, C.APPLICATION_DEFAULT_FLAGS))
|
||||
}
|
||||
|
||||
func setProgramName(prgName string) {
|
||||
cPrgName := C.CString(prgName)
|
||||
defer C.free(unsafe.Pointer(cPrgName))
|
||||
C.g_set_prgname(cPrgName)
|
||||
}
|
||||
|
||||
func appRun(app pointer) error {
|
||||
application := (*C.GApplication)(app)
|
||||
//TODO: Only set this if we configure it to do so
|
||||
|
|
|
|||
|
|
@ -513,13 +513,4 @@ type LinuxWindow struct {
|
|||
// Client code may override this behavior by passing a non-nil Options and set
|
||||
// WebviewGpuPolicy as needed.
|
||||
WebviewGpuPolicy WebviewGpuPolicy
|
||||
|
||||
// ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname().
|
||||
//This name should not be localized. [see the docs]
|
||||
//
|
||||
//When a .desktop file is created this value helps with window grouping and desktop icons when the .desktop file's Name
|
||||
//property differs form the executable's filename.
|
||||
//
|
||||
//[see the docs]: https://docs.gtk.org/glib/func.set_prgname.html
|
||||
ProgramName string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue