Fedora Desktop WMClass Fix
Audit and fix StartupWMClass mismatches in .desktop files for
Electron apps on Fedora/GNOME/Wayland. When StartupWMClass is
missing or uses the wrong case, GNOME cannot match a running window
to its pinned launcher icon, causing a duplicate generic icon to
appear on the taskbar (Window List) or dock. This skill detects
the problem across all installed Electron apps and can fix them
automatically.
Rules
Do NOT fabricate or invent command output, status, or results. Every report MUST come from actual script or command execution. If a command fails, report the actual error — do not guess.
Do NOT skip steps or combine multiple operations into one step. Execute each step in order and verify before proceeding.
This skill is purely mechanical — no semantic judgment is required. All decisions are made by the audit script. The agent MUST NOT interpret or evaluate results beyond what the script reports.
Prerequisites
- Fedora with GNOME desktop on Wayland
- One or more Electron apps installed (e.g., Goose, VS Code, Slack, Obsidian, Hermes)
Background: The Lowercase Convention
Electron apps on Wayland register their app-id using the
lowercase binary name (derived from the name field in
package.json or the executable filename). GNOME matches running
windows to .desktop files using this app-id against the
StartupWMClass field.
| Binary Name | Wayland app-id | Required StartupWMClass |
|---|---|---|
Goose |
goose |
goose |
Hermes |
hermes |
hermes |
Code |
code |
code |
When StartupWMClass is missing, wrong-cased (e.g., Goose instead
of goose), or absent entirely, GNOME shows:
- The pinned launcher icon (from favorites) — no running indicator
- A separate generic icon on the taskbar for the running window
This is a recurring problem because app reinstalls or updates often
overwrite the system .desktop file with a default that lacks
StartupWMClass or uses the original (wrong-cased) value.
Workflow
Step 1 — Audit
The agent MUST run the audit script to detect WMClass mismatches:
bash ~/.agents/skills/fedora-desktop-wmclass-fix/scripts/wmclass-audit.sh [--app NAME]
The agent MUST report the script output verbatim. Do NOT guess which apps have issues — the script detects them.
Step 2 — Fix
If mismatches are found, the agent MUST run the fix:
bash ~/.agents/skills/fedora-desktop-wmclass-fix/scripts/wmclass-audit.sh --fix [--app NAME]
The agent MUST report which files were modified.
Step 3 — Verify
The agent MUST instruct the user to restart the affected app(s) to confirm the duplicate icon is gone.
How the Script Works
The audit script (scripts/wmclass-audit.sh):
- Scans
.desktopfiles in:~/.local/share/applications/(user overrides)/usr/share/applications/(system)/var/lib/flatpak/exports/share/applications/(Flatpak)/var/lib/snapd/desktop/applications/(Snap)
-
Detects Electron apps by checking for
resources/app.asaradjacent to the binary referenced in theExec=line. -
Computes the expected
StartupWMClassby lowercasing the binary name (Electron’s Wayland convention). - Compares current vs expected and reports:
- ✅ OK — correct
- ⚠️ MISSING — no
StartupWMClassfield - ⚠️ MISMATCH — value doesn’t match expected lowercase
- In
--fixmode: copies system files to user dir if needed, sets/updatesStartupWMClass, and refreshes the desktop database.
Gotchas
-
Competing
.desktopfiles with the sameStartupWMClasscause duplicate icons. This is a common blind spot. Snap and Flatpak apps often install their own.desktopfile alongside a user override. If both have the sameStartupWMClass, GNOME matches running windows to both — the pinned favorite gets one match, and the second file spawns a duplicate icon. Always check for multiple.desktopfiles for the same app across allXDG_DATA_DIRSlocations and shadow extras withHidden=trueuser overrides. The audit script should be extended to detect this. -
--ozone-platform=x11changes Electron WM_CLASS behavior. When an Electron app is forced to X11 mode (e.g., by a wrapper script), it may create utility/splash windows with WM_CLASS set to the binary name (e.g.,Obsidian) instead of the app-id (e.g.,md.obsidian.Obsidian). Pass--class=<app-id>in the wrapper to force consistent WM_CLASS on all windows. -
Reinstalls reset the fix. When an Electron app is reinstalled or updated via RPM/deb, the system
.desktopfile is overwritten. The user-level override in~/.local/share/applications/is preserved, but if the system file was the only one, re-run this skill after updates. -
Some Electron apps set custom app-ids. A few Electron apps override the default Wayland app-id via
app.setDesktopFileName()or--classflag. In these cases, the lowercase-binary-name heuristic may not match. The script’s output will show a mismatch even after fixing — if the app still shows a duplicate icon after the fix, manually inspect the actual app-id. -
Flatpak Electron apps use the Flatpak app-id (e.g.,
com.slack.Slack) as the Wayland app-id, not the binary name. The script currently uses the binary name heuristic. Flatpak apps usually ship correct.desktopfiles, so this is rarely an issue. -
The
Goose.desktopuser override also containsGOOSE_SHELLandPATHin itsExec=line (from thegoose-desktop-env-fixskill). When this script copies/modifies the file, it preserves the existingExec=line — onlyStartupWMClassis touched. -
GNOME Shell Eval is restricted in GNOME 45+, so there is no programmatic way to query the actual Wayland app-id of a running window from a shell script. The lowercase heuristic is based on Electron’s source code behavior and confirmed empirically.
Verification
- Run the audit script — all Electron apps show ✅ OK
- Pinned Electron app icons on the dock show a running indicator (dot) when the app is open
- No duplicate generic icons appear on the Window List taskbar
- After app reinstall, re-running with
--fixrestores the correctStartupWMClass
Changelog
See CHANGELOG.md for version history.