NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.3k stars 13.54k forks source link

Some packages do not use absolute gapplication path in desktop files #53111

Open bug-buster-yom opened 5 years ago

bug-buster-yom commented 5 years ago

Issue description

Icons are missing in the menu for some applications. At least Gnome Maps and Gnome Weather.

Application are installed and can be invoked by command lines. It seems that it is just .desktop files that are missing.

Steps to reproduce

Install Gnome Maps and/or Gnome Weather. Related icons won't show in the Gnome Menu.

This can be worked around by creating .desktop files in ~/local/share/applications for the user.

Technical details

jtojnar commented 5 years ago

Do you mean that you have installed the packages with nix-env and bash -c 'IFS=:; for d in $XDG_DATA_DIRS; do find "$d" -name org.gnome.Weather.Application.desktop; done' returns no output?

Please note that GNOME Shell might need to be restarted for newly installed applications to appear due to a Freedesktop spec bug: https://github.com/NixOS/nixpkgs/issues/12757

bug-buster-yom commented 5 years ago

Well, Gnome Maps and Gnome Weather seem to be installed by default with Gnome. I guess services.xserver.desktopManager.gnome3.enable = true; in configuration.nix is enough to have it installed.

But, to further investigate, I did execute the commands you suggested:

Result:

/home/user/.nix-profile/share/applications/org.gnome.Weather.Application.desktop
/run/current-system/sw/share/applications/org.gnome.Weather.Application.desktop

So, there actually is a .desktop file, for Weather. For Maps, there is also a .desktop file:

/home/user/.nix-profile/share/applications/org.gnome.Maps.desktop
/run/current-system/sw/share/applications/org.gnome.Maps.desktop

(Notice: it's Maps.desktop and not Maps.Application.desktop)

On another computer, still in 18.03, with Gnome installed (services.xserver.desktopManager.gnome3.enable = true;) and not having run nix-env, I only have:

/run/current-system/sw/share/applications/org.gnome.Weather.Application.desktop

I'm not (yet) super proficient with Nix, but I understand that there is a system wide file installed from configuration.nix and a user specific one installed with nix-env. Seems good.

For Weather, in both 18.03 system wide desktop file and 18.09 user specific desktop file, we have:

Icon=org.gnome.Weather

For the desktop file of Gnome Photos, which is an application showing a proper icon in the menu, I have multiple Icon entries, with localizations. E.g. Icon[fr]=org.gnome.Photos.

The cause could be either the missing localization of icons in the desktop file; or a failure to link org.gnome.Weather with any actual icon file path.

jtojnar commented 5 years ago

I am not certain if the whole application entry was missing in the menu, or just that a question mark was displayed above the name instead of the proper icon. Could you clarify which one is the case?

Well, Gnome Maps and Gnome Weather seem to be installed by default with Gnome. I guess services.xserver.desktopManager.gnome3.enable = true; in configuration.nix is enough to have it installed.

Yep, that should be enough if you do not exclude them using environment.gnome3.excludePackages.

* `nix-env -i gnome-weather`

I was only trying to determine if you installed the apps using nix-env or through configuration.nix. Either one should be enough.

(Notice: it's Maps.desktop and not Maps.Application.desktop)

The name does not really matter; the .Application suffix is just something the Weather authors decided to do for some reason.

For the desktop file of Gnome Photos, which is an application showing a proper icon in the menu, I have multiple Icon entries, with localizations. E.g. Icon[fr]=org.gnome.Photos.

The non-localized Icon key is used as fallback so that should not be the case.

bug-buster-yom commented 5 years ago

I am not certain if the whole application entry was missing in the menu, or just that a question mark was displayed above the name instead of the proper icon. Could you clarify which one is the case?

No menu entry whatsoever is showing when hitting the meta key and searching both in the entire grid or by typing a few character for « Weather » or « Météo » (its name in French). No question mark icons.

The non-localized Icon key is used as fallback so that should not be the case.

After having double checked, I noticed that there is actually also a non localized Icon entry in the desktop file for Gnome Photos (which is showing properly in the menu).


I don't know if it helps, but I successfully worked around with a desktop file put in ~/local/share/applications. I did it with a file path (to a downloaded SVG file) as a value to Icon, with no localization.

Icon=/path/to/svg/file

So, the problem seems to come from a missing mapping between Icon=org.gnome.Weather and an actual icon.

jtojnar commented 5 years ago

Do you mean that if you cp /run/current-system/sw/share/applications/org.gnome.Weather.Application.desktop ~/.local/share/applications and restart GNOME Shell, it will not appear in the menu but after you change the Icon to an existing absolute path it will appear?

You could try to find the icon bash -c 'IFS=:; for d in $XDG_DATA_DIRS; do find "$d" -name org.gnome.Weather.png; done'.

bug-buster-yom commented 5 years ago

Some news. I did the test you requested.

Do you mean that if you cp /run/current-system/sw/share/applications/org.gnome.Weather.Application.desktop ~/.local/share/applications and restart GNOME Shell, it will not appear in the menu

Yes, absolutely.

but after you change the Icon to an existing absolute path it will appear?

No (to my surprise). When I worked around the bug, I made a quite minimalist desktop file from scratch. So I tried other changes.

In the copied desktop file, there is:

Exec=gapplication launch org.gnome.Weather.Application

When I replace it with Exec=gnome-weather, I suddenly have the icon showing (without needing to restart). This way, I get the Gnome Weather icon without having to change the Icon entry (but I can have another icon with a path to its file).

In the (working from start) Gnome Photos desktop file, there is Exec=gnome-photos.


bash -c 'IFS=:; for d in $XDG_DATA_DIRS; do find "$d" -name org.gnome.Weather.png; done'

Icons are found, various sizes (PNG files).

jtojnar commented 5 years ago

Oh, then I think it is because gapplication is not installed, we had a similar issue with GSConnect. Do they appear when you install glib.bin (or maybe it is in glib.dev on the old nixpkgs)? We ought to patch the files.

bug-buster-yom commented 5 years ago

Sorry, I did not find the package you want me to install. At https://nixos.org/nixos/packages.html I cannot find anything like glib*bin, glib*dev or gapplication.

jtojnar commented 5 years ago

The package is glib and it contains the gapplication binary in the bin output (or possibly in the dev output on old nixpkgs).

bug-buster-yom commented 5 years ago

So I:

  1. Removed the local desktop file to get back to a situation with Gnome Weather not showing in the menu.

  2. Added glib to the configuration.nix and nixos-rebuild switch.

  3. Restarted the computer, just to be sure.

Gnome Weather is not showing. But gapplication seems to be installed.

find / -name gapplication

find: ‘/run/user/1000/gvfs’: Permission denied
/nix/store/wsc3l9m3s0n4hpby4d69frqi7zyi5fnm-system-path/share/bash-completion/completions/gapplication
/nix/store/zb1m0cjd8d9m7c76q2zr8nrnzi6him4s-glib-2.56.0/share/bash-completion/completions/gapplication
/nix/store/0g0icfkz98f3hcb5sin35z2ciq1nsfv1-glib-2.56.0-dev/bin/gapplication
/nix/store/rdj63a6h1pvmxzaaz8w179f9pdl7jhva-system-path/share/bash-completion/completions/gapplication
/nix/store/g2jrz7fm4lnwrbhl444bcppls1ccfq7r-system-path/share/bash-completion/completions/gapplication

But it is not in the path, or at least I do not have the completion in a terminal when I type gapp<tab>. It was probably already installed before I explicitely added glib in configuration.nix. I can find it on my other (18.03) computer with no modifications to configuration.nix.

I am not sure I understood well what you requested me to do. I would have been very surprised to have Gnome installed without glib.

jtojnar commented 5 years ago

Did you explicitly add glib.dev to configuration.nix? It will probably not be installed unless you ask for it (before https://github.com/NixOS/nixpkgs/pull/38486).

Nix only adds to PATH the packages you mention in environment.systemPackages (or, more precisely, install to a profile used by the user). And of the packages, if they have multiple inputs, only certain inputs are installed by default.

Nix never adds transitive dependencies to a profile in order to allow applications depend on conflicting packages – this has a downside, the app needs to be able to find the dependency in the Nix store instead a global path like Nix profile or /usr; one example of that is the need to manually patch the desktop files to use full Nix store path to gapplication.

bug-buster-yom commented 5 years ago

OK, so I added glib.dev instead of glib in configuration.nix and then nixos-rebuild switch.

After that, I can see both Gnome Weather and Gnome Maps showing in the menu (with no local .desktop workaround).

nalck commented 4 years ago

Adding here because I believe my case is related:

While testing GNOME apps, I noticed that gnome-podcasts would download but not play anything. When launched from the terminal $ gnome-podcasts or from the Alt + F2 launcher with gnome-podcasts audio playback worked normally. The Activities overview launcher and $ gapplication launch org.gnome.Podcasts both failed to play audio.

After that exploration, I added this ~/.local/share/applications/org.gnome.Podcasts.desktop file:

[Desktop Entry]
Name=Podcasts
Comment=Find and listen to internet radio stations
Exec=gnome-podcasts
Icon[gl]=org.gnome.Podcasts
Icon=org.gnome.Podcasts
Terminal=false
Type=Application
Categories=AudioVideo;Audio;Player;GNOME;
Keywords=podcast;internet;radio;music;
StartupNotify=true

I then restarted GNOME Shell by doing Alt + F2 restart, and audio playback when launched from Activities worked as expected. The gapplication method as above still failed, however.

doronbehar commented 4 years ago

I can confirm that gnome-weather has an icon in my WM (Awesome). However, as @nalck has said, there are issues with the usage of gapplication launch - I experience it with Gnome Weather. I guess gapplication launch is especially problematic if the DE is not Gnome.

I'm ccing @lethalman @hedning @worldofpeace as the Gnome packageset maintainers who may be interested in solving this.

doronbehar commented 4 years ago

I can also confirm that installing glib has also fixed this.

worldofpeace commented 4 years ago

I guess there's one we need to patch in gnome-weather.

worldofpeace commented 4 years ago
share/applications/org.gnome.Weather.desktop
134:Exec=gapplication launch org.gnome.Weather
stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

jaredmontoya commented 1 month ago

not stale