electron-userland / electron-userland/electron-builder

Snap/Core24: Desktop Files and Desktop Environment integration (Generic Icons on taskbar and/or frame)

Open
#10,173 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.7k
Forks
1.9k
Avg merge
3d 12h
Merged PRs (30d)
48

Description

I am working with [Obsidian](https://obsidian.md) (the markdown editor). Recently, we have revamped our snap taking advantage of the new core24 pipeline of [electron-builder](https://www.electron.build). This has solved some long standing issues, however we have noticed new ones.

This thread is specifically about snaps and their integration with desktop environments under Wayland (which is enabled by default since circa Electron 38).

## The setup
1. desktopName, Wayland’s app_id are set to`md.obsidian.Obsidian` (following the convention of using FQDN), `StartupWMClass` is also set to `md.obsidian.Obsidian` within the `.desktop` file.
2. The snap produced by electron-builder (v26, `syncDesktopName=true`) has a template `meta/gui/md.obsidian.Obsidian.desktop` within the .snap. (NOTE: There is a separate issue that two desktop files are created see [here](https://github.com/electron-userland/electron-builder/issues/10077))
3. When the snap is installed, it (snapd?) creates `/var/lib/snapd/desktop/applications/obsidian_md.obsidian.Obsidian.desktop` (from `meta/gui/md.obsidian.Obsidian.desktop`).

## The problem (Generic Wayland icon)
The observed behavior when running Obsidian on (K)Ubuntu 26.04:
- GNOME: Icon in taskbar is generic wayland icon, icon in application switcher (alt-tab) is generic wayland
- KDE: Icon in taskbar in correct, icon in application frame and in the application switcher (alt-tab) is generic Wayland (See this [KDE-BR-466599](https://bugs.kde.org/show_bug.cgi?id=466599))
- XFCE: users also report problems, but I haven't tested.

## What window managers expect
- If I manually rename `/var/lib/snapd/desktop/applications/obsidian_md.obsidian.Obsidian.desktop` to `obsidian_obsidian.desktop` Gnome works, but KDE still has the same problems.
- If I manually rename `/var/lib/snapd/desktop/applications/obsidian_md.obsidian.Obsidian.desktop` to `md.obsidian.Obsidian.desktop` **everything works everywhere**.

## Why the problem specifically with Snaps
It seems that snapd creates `.desktop` files in `/var/lib/snapd/desktop/applications/` using the pattern `{snapname}-{originaldesktopfile}.desktop`.
All other package formats we support (deb, flatpak) install a `md.obsidian.Obsidian.desktop` and that works everywhere.

## The Solution?
I hope my understanding of the problem is correct. I am not sure what the solution to this problem is. Specifically, I am not sure:
1. If electron-builder should do something special while building the snap
OR
2. If this is something that snapd should handle with some manipulation at installation time
OR
3. If desktop environments have to become "snap" aware in their search for a match, that is the DE also searches for `obsidian-md.obsidian.Obsidian.desktop`.

Link to SnapCraft forum [topic](https://forum.snapcraft.io/t/snaps-wayland-and-desktop-environments-generic-icons-on-taskbar-and-or-frame/53094).

Contributor guide

Open the contributing guide

Research direction

Compare the meta/gui/md.obsidian.Obsidian.desktop template with the generated /var/lib/snapd/desktop/applications/obsidian_md.obsidian.Obsidian.desktop file and the snap packaging flow. First determine whether electron-builder, snapd, or desktop environments own the filename mismatch; done means the packaged application receives the expected Wayland and desktop-environment icon integration without manual renaming.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, linux
Domain
build-system, desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.