From 49cd0809a2c7d01c1169a0298a13ccc76b0d02f0 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 16 Jul 2026 10:47:11 +0300 Subject: [PATCH] fix(linux): set the Wayland window app_id so the dock shows the icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AppImage ships both the .desktop file and the hicolor icon, yet the dock button came up blank on Wayland. A Wayland compositor has no StartupWMClass to key on — it matches a window's app_id against the basename of an installed .desktop file to find its icon — and iced defaults window app_id to an empty string, which OCS never overrode, so nothing matched. Set application_id to the reverse-DNS id the .desktop is installed under, reusing the existing file_association::APP_ID const rather than a second copy. iced enables both the x11 and wayland winit backends by default and feeds the same application_id to each: on Wayland it is the app_id, on X11 it becomes WM_CLASS. So this also changes the X11 WM_CLASS, and the old StartupWMClass=OpenCADStudio would no longer match — realign it to the same id so X11 keeps working too. Confirmed on COSMIC/Wayland: the dock icon now appears. This is the Linux half of the same class of bug as the Windows taskbar report (#392, still open): the window not carrying the identity the OS needs to find its packaged icon. Co-Authored-By: Claude Opus 4.8 --- packaging/OpenCADStudio.desktop | 2 +- src/app/mod.rs | 11 +++++++++++ src/io/file_association.rs | 9 +++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packaging/OpenCADStudio.desktop b/packaging/OpenCADStudio.desktop index 3fe25cbbd..404d833c2 100644 --- a/packaging/OpenCADStudio.desktop +++ b/packaging/OpenCADStudio.desktop @@ -8,4 +8,4 @@ Type=Application Categories=Graphics;Engineering; MimeType=image/vnd.dwg;image/vnd.dxf; Keywords=CAD;DWG;DXF;drawing;design;engineering;2D;3D; -StartupWMClass=OpenCADStudio +StartupWMClass=io.github.HakanSeven12.OpenCadStudio diff --git a/src/app/mod.rs b/src/app/mod.rs index fa2857183..ec37d3623 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -2501,6 +2501,17 @@ impl OpenCADStudio { maximized: true, icon: window::icon::from_rgba(build_window_icon(), 32, 32).ok(), exit_on_close_request: false, + // A Wayland compositor has no StartupWMClass to go on: it resolves a + // window's dock icon by matching the window's app_id against the + // basename of an installed .desktop file. iced defaults the id to an + // empty string, so nothing matched and the dock button came up blank + // even though the AppImage ships both the .desktop and the icon. + // (X11 uses the .desktop's StartupWMClass and was unaffected.) + #[cfg(target_os = "linux")] + platform_specific: window::settings::PlatformSpecific { + application_id: crate::io::file_association::APP_ID.to_string(), + ..Default::default() + }, ..Default::default() }); let mut s = state; diff --git a/src/io/file_association.rs b/src/io/file_association.rs index f2a1ee210..6b4eeba68 100644 --- a/src/io/file_association.rs +++ b/src/io/file_association.rs @@ -22,11 +22,12 @@ //! would otherwise block the iced executor; the result is delivered back //! through a oneshot channel that the async wrapper awaits. -/// Reverse-DNS bundle / app id, shared by the macOS handler binding and the -/// Linux desktop-file name. Matches `CFBundleIdentifier` in packaging/Info.plist -/// and the installed `*.desktop` basename. +/// Reverse-DNS bundle / app id, shared by the macOS handler binding, the +/// Linux desktop-file name and the Wayland window app_id. Matches +/// `CFBundleIdentifier` in packaging/Info.plist and the installed `*.desktop` +/// basename. #[cfg(any(target_os = "macos", target_os = "linux"))] -const APP_ID: &str = "io.github.HakanSeven12.OpenCadStudio"; +pub(crate) const APP_ID: &str = "io.github.HakanSeven12.OpenCadStudio"; /// Silently register this app as *a* handler (not necessarily the default) for /// .dwg / .dxf, so it appears in the OS "Open with" list. Unlike