Skip to content

fix(flake.nix): Add .desktop entry and install icon#3157

Merged
houko merged 3 commits into
librefang:mainfrom
FrantaNautilus:fix/flake-desktop-icon
Apr 25, 2026
Merged

fix(flake.nix): Add .desktop entry and install icon#3157
houko merged 3 commits into
librefang:mainfrom
FrantaNautilus:fix/flake-desktop-icon

Conversation

@FrantaNautilus

Copy link
Copy Markdown
Contributor

Type

  • Agent template (TOML)
  • Skill (Python/JS/Prompt)
  • Channel adapter
  • LLM provider
  • Built-in tool
  • Bug fix
  • Feature (Rust)
  • Documentation / Translation
  • Refactor / Performance
  • CI / Tooling
  • Other

Summary

The PR adds the .desktop entry for librefang-desktop app, thus solves the issue #3156.

Changes

The flake.nix has new PostInstall instruction for librefang-desktop

Attribution

Does not apply.

Testing

Does not apply.

Security

Does not apply.

@github-actions github-actions Bot added ready-for-review PR is ready for maintainer review size/S 10-49 lines changed labels Apr 25, 2026
@github-actions
github-actions Bot requested a review from houko April 25, 2026 14:52
@houko

houko commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Thanks for picking this up — the fix solves #3156 cleanly.

One non-blocking suggestion if you'd like to revisit: the nixpkgs-idiomatic way to install a .desktop entry is makeDesktopItem + copyDesktopItems rather than hand-writing the file with cat. It's roughly the same number of lines but gives you typed fields (so a typo in categories fails the build instead of silently landing as a malformed entry), pulls in desktop-file-utils automatically (so the || true on update-desktop-database becomes unnecessary), and keeps the diff structurally similar to most other GUI apps in nixpkgs.

Sketch:

let
  desktopItem = pkgs.makeDesktopItem {
    name = "librefang-desktop";
    desktopName = "LibreFang";
    exec = "librefang-desktop";
    icon = "librefang-desktop";
    comment = "Open-source Agent Operating System";
    # `AI` isn't in the freedesktop main-category list — most menus
    # will silently drop it. `Utility` / `Network` / `Office` are the
    # standard ones; pick whichever fits best.
    categories = [ "Utility" "Network" ];
    keywords = [ "AI" "Agent" "LLM" "Automation" ];
    startupWMClass = "librefang-desktop";
  };
in
pkgs.rustPlatform.buildRustPackage {
  # … existing fields …
  nativeBuildInputs = (oldNativeBuildInputs or []) ++ [ pkgs.copyDesktopItems ];
  desktopItems = [ desktopItem ];

  postInstall = pkgs.lib.optionalString pkgs.stdenv.isLinux ''
    install -Dm644 ${./crates/librefang-desktop/icons/128x128.png} \
      $out/share/icons/hicolor/128x128/apps/librefang-desktop.png
    install -Dm644 ${./crates/librefang-desktop/icons/32x32.png} \
      $out/share/icons/hicolor/32x32/apps/librefang-desktop.png
  '';
}

Two side notes that apply either way:

  1. The icons/ dir already has 32x32.png, 128x128.png, [email protected] — installing at least 32×32 alongside 128×128 gives DEs a usable small-icon variant for taskbars / panels without forcing them to downscale.
  2. If StartupWMClass=librefang-desktop doesn't match the actual WM_CLASS Tauri sets at runtime, taskbars won't group the running window with the launcher icon. Worth a quick xprop WM_CLASS after launch to verify.

Either approach works — if you'd rather keep this PR small and merge as-is, I can open a follow-up later. Up to you.

@github-actions github-actions Bot added needs-changes Changes requested by reviewer and removed ready-for-review PR is ready for maintainer review labels Apr 25, 2026
@FrantaNautilus

Copy link
Copy Markdown
Contributor Author

Thanks for the help, my info on making desktop entries was outdated. I will improve the PR.

@github-actions github-actions Bot added ready-for-review PR is ready for maintainer review and removed needs-changes Changes requested by reviewer labels Apr 25, 2026
@houko
houko merged commit 9795f92 into librefang:main Apr 25, 2026
20 checks passed
@github-actions github-actions Bot removed the ready-for-review PR is ready for maintainer review label Apr 25, 2026
@FrantaNautilus

Copy link
Copy Markdown
Contributor Author

Sorry for being too slow with my refactor. You fixed it faster than my computer managed to compile it.

@houko houko mentioned this pull request Apr 26, 2026
@FrantaNautilus
FrantaNautilus deleted the fix/flake-desktop-icon branch June 27, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants