Skip to content

Set desktopName so Linux launchers match the app's window - #3172

Merged
mifi merged 1 commit into
mifi:masterfrom
nkboedecker:set-linux-desktop-name
Oct 23, 2026
Merged

mifi merged 1 commit into
mifi:masterfrom
nkboedecker:set-linux-desktop-name

Conversation

@nkboedecker

Copy link
Copy Markdown
Contributor

Problem

On Ubuntu 26.04 (GNOME 50.1, Wayland), LosslessCut 3.69.0's AppImage, integrated by AppImageLauncher, shows a generic icon in the dock instead of its own.

The AppImage's desktop entry says StartupWMClass=LosslessCut, but the window identifies itself as losslesscut: Wayland app_id losslesscut, X11 WM_CLASS "losslesscut", "Losslesscut". Electron now derives both from the product name, lowercased (electron/electron#49988, electron/electron#51424). If the launcher keeps the file name losslesscut.desktop, GNOME can still match it by file name, but AppImageLauncher installs it as appimagekit_<hash>-LosslessCut.desktop, so only StartupWMClass can link the two.

electron-builder warns about this in every Linux build (reason: "desktopName is not set in package.json"): "Without it desktop environments may not link running windows to this .desktop entry. Set desktopName in package.json and linux.syncDesktopName: true to fix."

It probably started with 3.69.0, the first release on Electron 42 (3.68.0 was on Electron 38), but I haven't tested 3.68.0.

Change

Set "desktopName": "losslesscut.desktop" in package.json. electron-builder then writes StartupWMClass=losslesscut, the same value no.mifi.losslesscut.desktop already uses for Flathub. Electron already defaults to this name, so the app's own app ID and WM_CLASS don't change.

I left out linux.syncDesktopName: the AppImage's desktop file is already named losslesscut.desktop, and I haven't tested what the option changes in the snap.

Testing

Ubuntu 26.04, GNOME 50.1, Electron 42.11.15, electron-builder 26.16.1. I built the x64 AppImage from master (8ae38b7e) with and without the change:

  • The two AppImages' losslesscut.desktop files differ in one line: StartupWMClass=LosslessCut became StartupWMClass=losslesscut. The build's desktopName warning is gone.
  • The packaged package.json has desktopName.
  • Both builds' windows report the same IDs: Wayland app_id losslesscut; X11 (--ozone-platform=x11) WM_CLASS "losslesscut", "Losslesscut". GNOME tries the WM_CLASS instance against StartupWMClass first (shell-window-tracker.c), so the new value matches on X11 too.
  • Making the same one-line change by hand in 3.69.0's AppImageLauncher launcher fixed the dock icon on GNOME (Wayland).

Not tested: the snap, other desktops (KDE and others), and the dock with the newly built AppImage installed in place of 3.69.0.

Prepared with help from Claude Code; the commit carries its Co-Authored-By trailer.

Electron now derives a window's Wayland app ID and X11 WM_CLASS from
the product name, lowercased: "losslesscut" (electron/electron#49988,
electron/electron#51424). Without desktopName, electron-builder still
writes StartupWMClass=LosslessCut into the AppImage's desktop entry,
and warns about it in every Linux build. When the launcher is
installed under another file name, as AppImageLauncher does, GNOME
then can't link the running window to it, and the dock shows a
generic icon.

Setting desktopName to the name Electron already defaults to makes
electron-builder write StartupWMClass=losslesscut, the value the
Flathub desktop file already uses. The app's own app ID and WM_CLASS
don't change.

Changelog: Linux: docks show LosslessCut's own icon for the AppImage when its launcher is installed under another name (e.g. by AppImageLauncher)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mifi
mifi merged commit 374eecf into mifi:master Oct 23, 2026
2 checks passed

mifi commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

thanks a lot for the thorough investigation and testing! merged, it'll be in the next nightly build and release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants