Skip to content

Commit

Permalink
add new programName option to linux options (#2817)
Browse files Browse the repository at this point in the history
* add new programName option to linux options

* modify changelog

* free program name string
  • Loading branch information
lyimmi authored Aug 9, 2023
1 parent b485798 commit e72e4aa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
6 changes: 6 additions & 0 deletions v2/internal/frontend/desktop/linux/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 9 additions & 0 deletions v2/pkg/options/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 13 additions & 1 deletion website/docs/reference/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<br/>
Type: string<br/>
### Debug
This defines [Debug specific options](#Debug) that apply to debug builds.
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e72e4aa

Please sign in to comment.