NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.06k forks source link

Gnome Activities icons should appear on app install #12757

Open jonocodes opened 8 years ago

jonocodes commented 8 years ago

I am using gnome3 in nixos. When I install an app in the console, I should be able to see it immediately in gnome's Activities. This is the case in ubuntu and arch when using gnome. In nix I have to logout and in in order to see the apps. Can this setup so I dont have to log out?

jgillich commented 8 years ago

You can also restart GNOME Shell with Alt+F2 and r. But I agree that having to restart is really really annoying and definitely something I want to look into at some point. Again cc @lethalman, maybe you have a clue what the issue is here?

lucabrunox commented 8 years ago

I never investigated this problem, but I believe the issue is with the fact that gnome shell watches xdg directories for changes, like ~/.nix-profile/share . However, that never changes in nix. What changes is ~/.nix-profile, hence gnome shell should watch whenever symlinks of profiles change rather than the contents of xdg directories.

I'm not sure what needs to be patched, but certainly something must be done as it's an unpleasant experience.

lucabrunox commented 8 years ago

After a quick look, it seems that gnome shell uses GDesktopAppInfo for listing apps. To do this, of course GDesktopAppInfo doesn't scan all the .desktop files everytime, rather it watches xdg directories for changes using GFileMonitor: https://github.com/GNOME/glib/blob/master/gio/gdesktopappinfo.c

I think this kind of approach is used by many desktops in general, not only GNOME, I wonder how it has been solved for e.g. kde or xfce. @ttuegel @vcunat do you know anything about this problem already?

ttuegel commented 8 years ago

AFAIK, KDE doesn't use inotify for this, the directories are scanned at startup.

lucabrunox commented 8 years ago

@ttuegel and so how does it detect when a new app is installed?

ttuegel commented 8 years ago

@lethalman It doesn't until you log out or call kbuildsycoca5. KDE has its own package manager that will do the latter automatically if you're using it, but of course it doesn't work with Nix.

jonocodes commented 8 years ago

Interestingly it looked like some apps behave differently. When I installed 'atom' I had to restart to see it. When install gnome-tweak-tool, I was able to see it immediately.

jgillich commented 8 years ago

Probably because gnome-tweak-tool is installed by default, unless you disabled optional packages. :)

jonocodes commented 8 years ago

ah. tricky

Profpatsch commented 6 years ago

triage: has this been fixed?

tadfisher commented 5 years ago

@Profpatsch No, this has not been fixed.

On a clean install with Gnome 3 enabled, this can be reproduced with:

nix-env -iA gimp

After installing, one has to log out of the desktop and log back in.

This is using a Gnome-Wayland session, btw.

wmertens commented 4 years ago

The KDE approach points to a way out: find the function in gnome-shell that gets called when the directory watchers ping it, and call it directly in the reload of the service. Also, fix the directory watchers so they know about symlinks, or disable them on store paths

wmertens commented 4 years ago

One more option that @emilazy pointed out but I only now understood, is to create a separate shadow XDG directories in e.g. /run/gnome-nix and ~/.config/gnome-nix which consists of real directories and symlinks to the files instead of the original store paths. This needs to be maintained on activation though, which makes it not work for nix-shell and nix-env.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

bjornfor commented 3 years ago

You can also restart GNOME Shell with Alt+F2 and r

Unfortunately that does not work on Wayland (which is the default now).

max-privatevoid commented 3 years ago

Guix has a patch for this: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/glib-appinfo-watch.patch I managed to port it to NixOS with a bit of s///g, I can clean it up a bit and open a PR if this is an acceptable solution.

nixos-discourse commented 3 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cinnamon-application-list-doesnt-update-until-cinnamon-is-restarted/14479/2

rhysmdnz commented 2 years ago

Fixed by #118100

nixos-discourse commented 2 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/required-nix-gnome-tweaks-hacks/20711/2

jtojnar commented 1 year ago

https://github.com/NixOS/nixpkgs/pull/118100 only fixed this partially:

Known limitation: On installations to /etc/profiles/per-user, the list of applications gets updated, but Shell fails to find the icons for new applications. This is the case when installing them declaratively through home-manager's NixOS module. Other methods, such as ad-hoc via nix-env/nix profile install work fine.

Upstream bug: https://gitlab.gnome.org/GNOME/glib/-/issues/144

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-make-home-packages-show-in-gnome-search/27748/3

zsmith009 commented 11 months ago

Still not fixed even though the original issue was opened in 2016. Fairly unbelievable.

bjornfor commented 11 months ago

Still not fixed even though the original issue was opened in 2016. Fairly unbelievable.

AFAIR, you can search and launch immediately, but the icon will be missing until re-login (a generic placeholder icon is used instead).

stereomato commented 11 months ago

not on nixos though:(

alex-robbins commented 11 months ago

not on nixos though

You sure? I just yesterday saw it working exactly as bjornfor described. After nixos-rebuild swtich, Gnome immediately picked up the new .desktop files and added them to the menu, just without the right icon.

Seems to me that this issue is reduced to tracking an upstream bug as per the Apr. 30 comment.

stereomato commented 11 months ago

yeah, but i use nixos + home-manager (standalone, like to keep system and user separated). I wonder if that's the thing :thinking:

cartoonnerie commented 7 months ago

I just ran into the issue today. I am a complete newbie so I may make some other mistake. The app icon does not appear after installing an app through nixos and home-manager

DaniD3v commented 7 months ago

ran into this issue on stable branch. It worked on unstable

nixos-discourse commented 4 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/missing-icon-in-gnome/47708/3

Ceralex commented 3 months ago

The ~/.nix-profile/share/application seems to update correctly when installing a new package, so I've written this temporary fix that automatically creates symlinks when the event fires. Note that I'm using home-manager and i install packages as user-only.

Inside home.nix

home.activation.copyDesktopFiles = lib.hm.dag.entryAfter ["installPackages"] ''
    if [ "$XDG_CURRENT_DESKTOP" = "GNOME" ]; then
      if [ -d "${config.home.homeDirectory}/.nix-profile/share/applications" ]; then
        rm -rf ${config.home.homeDirectory}/.local/share/applications
        mkdir -p ${config.home.homeDirectory}/.local/share/applications
        for file in ${config.home.homeDirectory}/.nix-profile/share/applications/*; do
          ln -sf "$file" ${config.home.homeDirectory}/.local/share/applications/
        done
      fi
    fi
  '';
mmayla commented 2 months ago

Your script is the only thing that worked for me, thanks @Ceralex!