Skip to content

Commit a76a9a3

Browse files
committed
fix(linux): apply the window title to frameless windows
setTitle skipped gtk_window_set_title whenever the window was created with Frameless: true. newWindowImpl applies options.Title through that same method, so a frameless window never received a title at all, and every later SetTitle call was dropped too. On Linux the title is not a titlebar: gtk_window_set_title writes the WM_NAME/_NET_WM_NAME hints that taskbars, window switchers and pagers label the window with. Decorations are governed separately, by gtk_window_set_decorated in setFrameless/setBorderless, so titling an undecorated window draws nothing. The visible effect was that every window of a frameless application carried the same label — the g_set_prgname fallback — leaving multiple windows indistinguishable in the taskbar and in alt-tab. Applies to both the GTK4 and GTK3 backends.
1 parent 86b39da commit a76a9a3

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

v3/UNRELEASED_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file
2323

2424
## Fixed
2525
<!-- Bug fixes -->
26+
- 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
2627

2728
## Deprecated
2829
<!-- Soon-to-be removed features -->

v3/pkg/application/linux_cgo.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,11 +1306,13 @@ func (w *linuxWebviewWindow) present() {
13061306
}
13071307

13081308
func (w *linuxWebviewWindow) setTitle(title string) {
1309-
if !w.parent.options.Frameless {
1310-
cTitle := C.CString(title)
1311-
C.gtk_window_set_title(w.gtkWindow(), cTitle)
1312-
C.free(unsafe.Pointer(cTitle))
1313-
}
1309+
// Set unconditionally, frameless included: gtk_window_set_title writes the
1310+
// WM_NAME/_NET_WM_NAME hints that taskbars and window switchers label the
1311+
// window with, it does not draw a titlebar. Decorations are governed
1312+
// separately, by gtk_window_set_decorated.
1313+
cTitle := C.CString(title)
1314+
C.gtk_window_set_title(w.gtkWindow(), cTitle)
1315+
C.free(unsafe.Pointer(cTitle))
13141316
}
13151317

13161318
func (w *linuxWebviewWindow) setSize(width, height int) {

v3/pkg/application/linux_cgo_gtk3.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,11 +1704,13 @@ func (w *linuxWebviewWindow) setOpacity(opacity float64) {
17041704
}
17051705

17061706
func (w *linuxWebviewWindow) setTitle(title string) {
1707-
if !w.parent.options.Frameless {
1708-
cTitle := C.CString(title)
1709-
C.gtk_window_set_title(w.gtkWindow(), cTitle)
1710-
C.free(unsafe.Pointer(cTitle))
1711-
}
1707+
// Set unconditionally, frameless included: gtk_window_set_title writes the
1708+
// WM_NAME/_NET_WM_NAME hints that taskbars and window switchers label the
1709+
// window with, it does not draw a titlebar. Decorations are governed
1710+
// separately, by gtk_window_set_decorated.
1711+
cTitle := C.CString(title)
1712+
C.gtk_window_set_title(w.gtkWindow(), cTitle)
1713+
C.free(unsafe.Pointer(cTitle))
17121714
}
17131715

17141716
func (w *linuxWebviewWindow) setIcon(icon pointer) {

0 commit comments

Comments
 (0)