Proper icon when using makeDesktopItem

Hi there,

I came accross this snippet while surfing GitHub.

# https://raw.githubusercontent.com/Gako358/dotfiles/6236f706279d2450606dfc99fecce9399936b7e7/home/programs/browser/teams.nix
{ config, pkgs, ... }: {
  home.packages = with pkgs;
    let
      teams-chromium = makeDesktopItem {
        name = "Teams";
        desktopName = "Teams";
        genericName = "Microsoft Teams";
        exec = ''
          ${config.programs.chromium.package}/bin/chromium --ozone-platform-hint=auto --force-dark-mode --enable-features=WebUIDarkMode --app="https://teams.live.com"'';
        icon = "teams";
        categories = [ "Network" "InstantMessaging" ];
        mimeTypes = [ "x-scheme-handler/teams" ];
      };
    in [ teams-chromium ];
}

this works great, But what if not working is the icon. I know it has to do with the class, etc. but I cannot get it working. Any tips? Right now it using my chromium icon.

Thank you.

ok, so I could never “set” the wm_class, however if create a desktop file with something like:

[Desktop Entry]
Type=Application
Name=Nixpkgs Search
StartupWMClass=chrome-search.nixos.org__packages-Default
Comment=Launch Nixpkgs Search
Icon=/home/dustin/.local/share/xdg-desktop-portal/icons/192x192/nix.png
Exec=chromium --ozone-platform-hint=auto --force-dark-mode --enable-features=WebUIDarkMode  --app="https://search.nixos.org/packages" %U
Terminal=false

This would work. Since I could not set the wmclass, I had to see that they were running as and set the StartupWMClass in the desktop file match.

SInce I am on wayland I use LookingGlass (Gnome) to get the wmclass (rebuilt without the StartupWMClass being set, ran - then observed).

The most annoying thing is that you cannot copy the classname. And they can be funky.