diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 33638e7fc86..a1090a967fb 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Apply the window title to frameless windows on Linux, so taskbars and window switchers can tell an application's windows apart in [PR](https://github.com/wailsapp/wails/pull/5960) by @julianstorer ## Deprecated diff --git a/v3/pkg/application/linux_cgo.go b/v3/pkg/application/linux_cgo.go index e4751c88262..3c7db624ad7 100644 --- a/v3/pkg/application/linux_cgo.go +++ b/v3/pkg/application/linux_cgo.go @@ -1306,11 +1306,13 @@ func (w *linuxWebviewWindow) present() { } func (w *linuxWebviewWindow) setTitle(title string) { - if !w.parent.options.Frameless { - cTitle := C.CString(title) - C.gtk_window_set_title(w.gtkWindow(), cTitle) - C.free(unsafe.Pointer(cTitle)) - } + // Set unconditionally, frameless included: gtk_window_set_title writes the + // WM_NAME/_NET_WM_NAME hints that taskbars and window switchers label the + // window with, it does not draw a titlebar. Decorations are governed + // separately, by gtk_window_set_decorated. + cTitle := C.CString(title) + C.gtk_window_set_title(w.gtkWindow(), cTitle) + C.free(unsafe.Pointer(cTitle)) } func (w *linuxWebviewWindow) setSize(width, height int) { diff --git a/v3/pkg/application/linux_cgo_gtk3.go b/v3/pkg/application/linux_cgo_gtk3.go index 4b4be6eaf28..9df0e7ac2b6 100644 --- a/v3/pkg/application/linux_cgo_gtk3.go +++ b/v3/pkg/application/linux_cgo_gtk3.go @@ -1704,11 +1704,13 @@ func (w *linuxWebviewWindow) setOpacity(opacity float64) { } func (w *linuxWebviewWindow) setTitle(title string) { - if !w.parent.options.Frameless { - cTitle := C.CString(title) - C.gtk_window_set_title(w.gtkWindow(), cTitle) - C.free(unsafe.Pointer(cTitle)) - } + // Set unconditionally, frameless included: gtk_window_set_title writes the + // WM_NAME/_NET_WM_NAME hints that taskbars and window switchers label the + // window with, it does not draw a titlebar. Decorations are governed + // separately, by gtk_window_set_decorated. + cTitle := C.CString(title) + C.gtk_window_set_title(w.gtkWindow(), cTitle) + C.free(unsafe.Pointer(cTitle)) } func (w *linuxWebviewWindow) setIcon(icon pointer) {