Packaged windows claim `com.nousresearch.hermes` as their Wayland app id (electron-builder bakes product-identity.cjs's `appId` into extraMetadata.desktopName; Electron hands that string to the compositor verbatim), while the entry was written as `hermes.desktop` with `StartupWMClass=Hermes` — so GNOME matched neither StartupWMClass nor a `<app_id>.desktop` file name and every launch fell back to the placeholder icon, with the raw app id in the tooltip. - write `<app_id>.desktop` with `StartupWMClass=<app_id>` (Name= stays "Hermes") - retire a leftover `hermes.desktop` once the new entry is on disk, and only when the file still names this app and launcher management is enabled; foreign files at that path are left alone - nix/desktop.nix derives the entry file name from the module instead of hardcoding it - tests: the installed entry carries the app id, legacy retirement, foreign-file preservation, opt-out preservation, plus a node probe asserting APP_ID == product-identity.cjs appId Known consequence: an existing taskbar pin points at the old entry id and has to be re-added once.
37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
"""Native Linux launcher management through real config and filesystem I/O."""
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.linux_desktop_entry import DESKTOP_ENTRY_NAME, install_desktop_entry
|
|
|
|
|
|
@pytest.mark.platforms("linux")
|
|
def test_launcher_optout_preserves_custom_entry_but_creates_missing(tmp_path, monkeypatch):
|
|
home = tmp_path / "home"
|
|
home.mkdir()
|
|
monkeypatch.setenv("HOME", str(home))
|
|
monkeypatch.setenv("HERMES_HOME", str(home))
|
|
monkeypatch.setenv("XDG_DATA_HOME", str(tmp_path / "xdg"))
|
|
monkeypatch.setenv("PATH", "/usr/bin:/bin")
|
|
monkeypatch.setattr(Path, "home", lambda: home)
|
|
config = home / "config.yaml"
|
|
config.write_text("desktop:\n manage_launcher_entry: false\n", encoding="utf-8")
|
|
root = tmp_path / "checkout"
|
|
root.mkdir()
|
|
entry = tmp_path / "xdg" / "applications" / DESKTOP_ENTRY_NAME
|
|
entry.parent.mkdir(parents=True)
|
|
custom = b"[Desktop Entry]\nType=Application\nName=Custom Hermes\nExec=/opt/custom-hermes desktop\n"
|
|
for setting in ("false", '"false"'):
|
|
config.write_text(f"desktop:\n manage_launcher_entry: {setting}\n", encoding="utf-8")
|
|
entry.write_bytes(custom)
|
|
assert install_desktop_entry(root) == entry
|
|
assert entry.read_bytes() == custom
|
|
entry.unlink()
|
|
assert install_desktop_entry(root) == entry
|
|
assert b"Name=Hermes\n" in entry.read_bytes()
|
|
config.write_text("desktop: {}\n", encoding="utf-8")
|
|
entry.write_bytes(custom)
|
|
assert install_desktop_entry(root) == entry
|
|
assert entry.read_bytes() != custom
|