diff --git a/v2/internal/frontend/desktop/linux/frontend.go b/v2/internal/frontend/desktop/linux/frontend.go
index 14c202d82..2f6f286fa 100644
--- a/v2/internal/frontend/desktop/linux/frontend.go
+++ b/v2/internal/frontend/desktop/linux/frontend.go
@@ -190,6 +190,12 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
C.install_signal_handlers()
+ if appoptions.Linux != nil && appoptions.Linux.ProgramName != "" {
+ prgname := C.CString(appoptions.Linux.ProgramName)
+ C.g_set_prgname(prgname)
+ C.free(unsafe.Pointer(prgname))
+ }
+
return result
}
diff --git a/v2/pkg/options/linux/linux.go b/v2/pkg/options/linux/linux.go
index 3726297c4..062119cb7 100644
--- a/v2/pkg/options/linux/linux.go
+++ b/v2/pkg/options/linux/linux.go
@@ -29,6 +29,15 @@ type Options struct {
// - WebviewGpuPolicyOnDemand
// - WebviewGpuPolicyNever
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
}
type Messages struct {
diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx
index 5eb5f0972..af772c8bd 100644
--- a/website/docs/reference/options.mdx
+++ b/website/docs/reference/options.mdx
@@ -105,7 +105,8 @@ func main() {
Linux: &linux.Options{
Icon: icon,
WindowIsTranslucent: false,
- WebviewGpuPolicy: linux.WebviewGpuPolicyAlways,
+ WebviewGpuPolicy: linux.WebviewGpuPolicyAlways,
+ ProgramName: "wails"
},
Debug: options.Debug{
OpenInspectorOnStartup: false,
@@ -898,6 +899,17 @@ Default: `WebviewGpuPolicyAlways`
| WebviewGpuPolicyOnDemand | Hardware acceleration is enabled/disabled as request by web contents|
| WebviewGpuPolicyNever | Hardware acceleration is always disabled |
+#### ProgramName
+
+This option 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](https://docs.gtk.org/glib/func.set_prgname.html).
+
+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.
+
+Name: ProgramName
+Type: string
+
### Debug
This defines [Debug specific options](#Debug) that apply to debug builds.
diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx
index 6ffd1d64c..8b215c912 100644
--- a/website/src/pages/changelog.mdx
+++ b/website/src/pages/changelog.mdx
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added smart functionality for the default context-menu in production with CSS styles to control it. Added by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2748)
- Added custom error formatting to allow passing structured errors back to the frontend.
- Added sveltekit.mdx guide. Added by @figuerom16 in [PR](https://github.com/wailsapp/wails/pull/2771)
+- Added ProgramName option to [linux.Options](/docs/reference/options#linux). Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2817)
### Changed