Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnome Activities icons should appear on app install #12757

Open
jonocodes opened this issue Feb 1, 2016 · 31 comments · Fixed by #118100
Open

Gnome Activities icons should appear on app install #12757

jonocodes opened this issue Feb 1, 2016 · 31 comments · Fixed by #118100
Labels
0.kind: bug Something is broken 6.topic: GNOME GNOME desktop environment and its underlying platform

Comments

@jonocodes
Copy link

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
Copy link
Member

jgillich commented Feb 2, 2016

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
Copy link
Contributor

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 lucabrunox added 0.kind: bug Something is broken 6.topic: GNOME GNOME desktop environment and its underlying platform labels Feb 2, 2016
@lucabrunox
Copy link
Contributor

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
Copy link
Member

ttuegel commented Feb 2, 2016

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

@lucabrunox
Copy link
Contributor

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

@ttuegel
Copy link
Member

ttuegel commented Feb 2, 2016

@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
Copy link
Author

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
Copy link
Member

jgillich commented Feb 2, 2016

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

@jonocodes
Copy link
Author

ah. tricky

@Mounium Mounium mentioned this issue Apr 3, 2017
24 tasks
@Profpatsch
Copy link
Member

triage: has this been fixed?

@tadfisher
Copy link
Contributor

@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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link

stale bot commented Nov 21, 2020

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

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 21, 2020
@bjornfor
Copy link
Contributor

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

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

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 21, 2020
@max-privatevoid
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

rhysmdnz commented Mar 3, 2022

Fixed by #118100

@rhysmdnz rhysmdnz closed this as completed Mar 3, 2022
@nixos-discourse
Copy link

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
Copy link
Member

jtojnar commented Apr 30, 2023

#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

@jtojnar jtojnar reopened this Apr 30, 2023
@nixos-discourse
Copy link

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

This comment was marked as spam.

@bjornfor
Copy link
Contributor

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
Copy link

not on nixos though:(

@alex-robbins
Copy link

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
Copy link

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

@cartoonnerie

This comment was marked as duplicate.

@DaniD3v

This comment was marked as duplicate.

@nixos-discourse
Copy link

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
Copy link

Ceralex commented Jul 26, 2024

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
Copy link

mmayla commented Aug 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: GNOME GNOME desktop environment and its underlying platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.