From 49865b7b8f879a3b6a1a92c26a4f3c149e2e7678 Mon Sep 17 00:00:00 2001 From: James Coleman Date: Tue, 29 Sep 2026 14:35:42 -0500 Subject: [PATCH] fix(gui): name the window so Linux taskbars pair it with its entry - The window never had a title, so taskbars and window lists showed it as untitled on every Linux desktop; it is now titled "Midi Harbor". The header draws its own title, which is why it went unnoticed. - On X11 the window's class comes from argv[0], because the pinned libcosmic replaces its X11 window attributes with its Wayland ones. The desktop entry's StartupWMClass is now midi-harbor, the class a package install gets, so X11 taskbars match the window to its entry and icon; Wayland still pairs by the application ID. --- crates/gui/src/app.rs | 8 +++++++- packaging/linux/com.mrgeckosmedia.MidiHarbor.desktop | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/gui/src/app.rs b/crates/gui/src/app.rs index 46770e2..288a8d2 100644 --- a/crates/gui/src/app.rs +++ b/crates/gui/src/app.rs @@ -784,7 +784,7 @@ impl cosmic::Application for App { activity_filter.insert().text("Problems only"); activity_filter.activate_position(0); - let app = App { + let mut app = App { core, nav, page: Page::Endpoints, @@ -810,6 +810,12 @@ impl cosmic::Application for App { // have filled. let connect = cosmic::task::future(async { Message::Connected(Client::connect(socket).await) }); + // The window's title, which taskbars and window lists show; libcosmic leaves it empty, + // and the header draws its own. + let connect = match app.core.main_window_id() { + Some(id) => Task::batch([connect, app.set_window_title("Midi Harbor".to_owned(), id)]), + None => connect, + }; // The menus as a message rather than now: the window is set up before the event loop // runs, and winit builds its default menu once it does, over anything installed earlier. #[cfg(target_os = "macos")] diff --git a/packaging/linux/com.mrgeckosmedia.MidiHarbor.desktop b/packaging/linux/com.mrgeckosmedia.MidiHarbor.desktop index c859b25..7a58403 100644 --- a/packaging/linux/com.mrgeckosmedia.MidiHarbor.desktop +++ b/packaging/linux/com.mrgeckosmedia.MidiHarbor.desktop @@ -4,7 +4,8 @@ Name=Midi Harbor Comment=Virtual MIDI ports, hardware, network sessions and Bluetooth MIDI that reconnect by themselves Exec=midi-harbor gui Icon=com.mrgeckosmedia.MidiHarbor -StartupWMClass=com.mrgeckosmedia.MidiHarbor +# On X11 the window's class is argv[0]'s file name; Wayland pairs by the application ID instead. +StartupWMClass=midi-harbor Terminal=false Categories=AudioVideo;Audio;Midi; Keywords=MIDI;RTP-MIDI;Network MIDI;Bluetooth;