Is there any way to modify an application's .desktop file?

I use signal-desktop and would like to add --use-tray-icon to the .desktop file. Unfortunately, /run/current-system/sw/share/applications/signal-desktop.desktop is read only. I tried creating my own .desktop file in .local/share/applications but that didn’t work in that signal-desktop does not show up in gnome shell’s search.

Is there some way to set up my configuration.nix file to make this modification automatic with a rebuild?

That’s odd. Normally desktop files in ~/.local/share/applications take precedence over the system-wide ones and that is what I observe on my machine. However, I think you have to log out and log in again to refresh the list in GNOME.

EDIT: The Arch Wiki suggest that you run update-desktop-database after installing custom desktop files. On NixOS you could use

nix-shell -p desktop_file_utils --run "update-desktop-database -v ~/.local/share/applications"
1 Like

Many thanks! Worked perfectly!

For future reference, it can be done a bit more declaratively/reproducibly with home-manager: Appendix A. Configuration Options

I believe this also refreshes the cache on rebuild, but this may also just be because I don’t use GNOME.

Without home-manager, a fair number of packages define the desktop entry in a way that is fairly easy to override, though sadly signal is not one of them.

1 Like