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.
This commit is contained in:
James Coleman 2026-09-29 14:35:42 -05:00
parent 92cc30e381
commit 49865b7b8f
2 changed files with 9 additions and 2 deletions

View file

@ -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")]

View file

@ -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;