Double Signal app after fixing keyring error

I’ve moved from GNOME to Niri, and I’ve encountered a Signal error I believe not to be uncommon:


In fact, there is already a thread here from a few months ago.

However, unlike them, I fixed mine by adding this in my home.nix:

  xdg.desktopEntries = {
    signal-desktop = {
      name = "Signal";
      exec = "signal-desktop --password-store=gnome-libsecret %U";
      terminal = false;
      categories = ["Network" "InstantMessaging"];
      icon = "signal-desktop";
    };
  };

This, as expected (?), created an extra Signal app entry in my launcher, although I hoped it would not.

Is there a way to eliminate duplication and have only one Signal app (with working command) in the launcher?

The xdg desktop spec allows overriding the way you do; you need to exactly match the .desktop filename though. Just set the name to signal (makeDesktopItem uses that name):

# home.nix
{
  xdg.desktopEntries = {
    signal = {
      name = "Signal";
      exec = "signal-desktop --password-store=gnome-libsecret %U";
      terminal = false;
      categories = ["Network" "InstantMessaging"];
      icon = "signal-desktop";
    };
  };
}

You may want to use an override instead, by the way:

# home.nix
{ pkgs, lib, ... }: {
  xdg.dataFile."applications/signal.desktop" = let
    desktopItem = (lib.head pkgs.signal-desktop.desktopItems).override {
      exec = "${pkgs.signal.meta.mainProgram} --password-store=gnome-libsecret %U";
    };
  in
    "${desktopItem}/share/applications/signal.desktop";
}

… unfortunately makeDesktopItem doesn’t passthru its inputs, so you can’t get the name arg back out.

2 Likes

Thank you very much for both tips! I assumed the name was the same as the package. Silly of me to assume.