midi-harbor/specs/017-appimage/tasks.md
James Coleman 43f7b8916b fix(appimage): install the desktop entry so the window gets its icon
- A Wayland desktop finds a window's icon by looking up its application ID among the installed desktop entries. An AppImage carries its entry and icon inside its own tree, where no desktop looks, so its window showed the generic Wayland icon and Midi Harbor was missing from the application menu.
- Run from an AppImage, the window now installs com.mrgeckosmedia.MidiHarbor.desktop under $XDG_DATA_HOME/applications and the icon under icons/hicolor/scalable/apps before it opens. Exec is rewritten to the AppImage file, quoted as the Desktop Entry Specification requires, and each file is written only when it differs, so a moved AppImage is followed.
- TryExec names the AppImage file, so desktops stop offering the entry once the file is deleted, which is how an AppImage is removed.
- Nothing is installed when a directory in XDG_DATA_DIRS already holds the entry: one under the user's directory takes precedence and would point a package's menu item at the AppImage.
2026-10-02 12:32:08 -05:00

2.2 KiB

Tasks: AppImage

Tasks by their numbers in the project-wide sequence, which continues across every spec.

  • T246 Register the AppImage file rather than the executable inside its mount, per FR-I01 and FR-I04 — done: ServiceSpec::for_current_executable takes APPIMAGE when the running executable is under APPDIR, so another AppImage's inherited variables are ignored; and the unit's ExecStop stops the daemon alone and waits for it, since stopping the whole unit at once unmounted the AppImage under the daemon and killed it with SIGBUS (R-104). Unit tested in crates/service/src/lib.rs against the variables the AppImage runtime sets, and in crates/service/src/systemd.rs for the ExecStop.
  • T247 Build and publish an AppImage for each Linux architecture, per FR-I02 and FR-I03 — done: packaging/linux/appimage.sh, run by GoReleaser after each full Linux build, bundles the Avahi client libraries and their license from the sysroot, sets the binary's RUNPATH, and packs it with appimagetool and the pinned runtime, which the cross image now carries; the release and checksums include dist/*.AppImage. Checked on Arch Linux and Ubuntu 22.04 (R-104); not unit tested, since it is a build script.
  • T248 Name the window on Linux so taskbars pair it with its desktop entry — done: the window's title is set to "Midi Harbor" at start, the desktop entry's StartupWMClass is midi-harbor, and the AppImage's AppRun runs the binary as midi-harbor, since the pinned libcosmic leaves the X11 class to argv[0] (R-104). Checked in XFCE on X11; not unit tested, since it is window-system wiring.
  • T254 Install the AppImage's desktop entry and icon for the user when the window runs from one, so a Wayland desktop finds its icon by application ID, per FR-I05 (R-109) — done: desktop::integrate runs before the window opens on Linux; Exec and TryExec name the AppImage file; nothing is written where a package provides the entry, or when the files already match. Unit tests cover the entry as the Desktop Entry Specification reads it, with a path holding a space, a dollar and a percent sign, and installing once and never over a package. Checked on XFCE: the entry passed desktop-file-validate and the taskbar gained the icon. Not seen on Wayland.