Open jonocodes opened 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?
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.
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?
AFAIK, KDE doesn't use inotify for this, the directories are scanned at startup.
@ttuegel and so how does it detect when a new app is installed?
@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.
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.
Probably because gnome-tweak-tool is installed by default, unless you disabled optional packages. :)
ah. tricky
triage: has this been fixed?
@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.
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
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.
I marked this as stale due to inactivity. → More info
You can also restart GNOME Shell with Alt+F2 and r
Unfortunately that does not work on Wayland (which is the default now).
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.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
Fixed by #118100
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
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
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
Still not fixed even though the original issue was opened in 2016. Fairly unbelievable.
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).
not on nixos though:(
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.
yeah, but i use nixos + home-manager (standalone, like to keep system and user separated). I wonder if that's the thing :thinking:
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
ran into this issue on stable branch. It worked on unstable
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
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
'';
Your script is the only thing that worked for me, thanks @Ceralex!
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?