diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go
index a513e875a..1e4289ee6 100644
--- a/v2/internal/frontend/desktop/windows/window.go
+++ b/v2/internal/frontend/desktop/windows/window.go
@@ -70,8 +70,13 @@ func NewWindow(parent winc.Controller, appoptions *options.App, versionInfo *ope
var dwStyle = w32.WS_OVERLAPPEDWINDOW
- winc.RegClassOnlyOnce("wailsWindow")
- handle := winc.CreateWindow("wailsWindow", parent, uint(exStyle), uint(dwStyle))
+ windowClassName := "wailsWindow"
+ if windowsOptions != nil && windowsOptions.WindowClassName != "" {
+ windowClassName = windowsOptions.WindowClassName
+ }
+
+ winc.RegClassOnlyOnce(windowClassName)
+ handle := winc.CreateWindow(windowClassName, parent, uint(exStyle), uint(dwStyle))
result.SetHandle(handle)
winc.RegMsgHandler(result)
result.SetParent(parent)
diff --git a/v2/pkg/options/windows/windows.go b/v2/pkg/options/windows/windows.go
index 39b91ee8d..8f3bce44a 100644
--- a/v2/pkg/options/windows/windows.go
+++ b/v2/pkg/options/windows/windows.go
@@ -118,6 +118,9 @@ type Options struct {
// Configure whether swipe gestures should be enabled
EnableSwipeGestures bool
+
+ // Class name for the window. If empty, 'wailsWindow' will be used.
+ WindowClassName string
}
func DefaultMessages() *Messages {
diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx
index e94c22f47..efcc67961 100644
--- a/website/docs/reference/options.mdx
+++ b/website/docs/reference/options.mdx
@@ -99,7 +99,9 @@ func main() {
// OnResume is called when Windows resumes from low power mode
OnResume: func(),
// Disable GPU hardware acceleration for the webview
- WebviewGpuDisabled: false,
+ WebviewGpuDisabled: false,
+ // Class name for the window. If empty, 'wailsWindow' will be used.
+ WindowClassName: "MyWindow",
},
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
@@ -322,7 +324,7 @@ If not defined, the result is the following in cases where the Handler would hav
:::info
-This does not work with vite v5.0.0+ and wails v2 due to changes in vite.
+This does not work with vite v5.0.0+ and wails v2 due to changes in vite.
Changes are planned in v3 to support similar functionality under vite v5.0.0+.
If you need this feature, stay with vite v4.0.0+.
See [issue 3240](https://github.com/wailsapp/wails/issues/3240) for details
@@ -804,6 +806,13 @@ Setting this to `true` will enable swipe gestures for the webview.
Name: EnableSwipeGestures
Type: `bool`
+#### WindowClassName
+
+Class name for the window. If empty, 'wailsWindow' will be used.
+
+Name: WindowClassName
+Type: `string`
+
### Mac
This defines [Mac specific options](#mac).
diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx
index 9890a0cfa..b90a8549c 100644
--- a/website/src/pages/changelog.mdx
+++ b/website/src/pages/changelog.mdx
@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Security` in case of vulnerabilities.
## [Unreleased]
+### Added
+- Added option to set window class name on Windows. Added in [PR](https://github.com/wailsapp/wails/pull/3828) by @APshenkin
+
### Fixed
- Fixed cross compilation failed with CGO [PR](https://github.com/wailsapp/wails/pull/3795) by [@fcying](https://github.com/fcying)