GNOME Bugzilla – Bug 703048
Create ~/.local/share/applications to get notified of new desktop files
Last modified: 2013-06-27 14:15:32 UTC
As explained on bug #702991, a newly created user doesn't have ~/.local/share/applications which means gnome-menus doesn't add a file monitor for it. This means gnome-shell doesn't get notified about changes to that dir, and so new desktop files don't appear in gnome-shell until the shell is restarted, which can be quite confusing. Fixing this in gnome-menus is a bit tricky partly because of bug #522314. A workaround for this is creating the directory from gnome-shell before getting the GMenuTree. The patch is very simple and does its job.
Created attachment 247720 [details] [review] appSystem: make sure XDG_DATA_HOME/applications exists So that we get notified if desktop files are added there.
Last time this kind of thing happened we fixed it in g-s-d. See bug 694134
Also see the mkdir (~/.local) commit that happened following that bug: https://git.gnome.org/browse/gnome-settings-daemon/commit/plugins/housekeeping/gsd-housekeeping-manager.c?id=7f4af9ab7824c0479e3f4e77742042949b6d32da
(In reply to comment #2) > Last time this kind of thing happened we fixed it in g-s-d. See bug 694134 That seems a bit different as it was g-s-d who was adding the monitor, so it made sense for g-s-d to create the dir. In this case it's libgnome-menus who adds the watch in a call from gnome-shell. Since creating a dir from a shared library doesn't sound so right to me, I thought gnome-shell would be the right place. The housekeeping g-s-d plugin sounds like it would also be a good fit... I don't mind it too much who creates the dir as long as we fix this issue. Bastien, would you accept a patch to create ~/.local/share/applications from the housekeeping plugin?
Sure, until we switch to a notification system that doesn't have those sort of architectural problems :/
Created attachment 247738 [details] [review] housekeeping: create ~/.local/share/applications So that gnome-shell/gnome-menus adds a monitor and the shell notices newly added desktop files.
(In reply to comment #5) > Sure, until we switch to a notification system that doesn't have those sort of > architectural problems :/ I look forward to that day! In the meantime, the attached patch should solve this. Tested with latest 3.8.x packages. Reassigning to g-s-d.
Review of attachment 247738 [details] [review]: ::: plugins/housekeeping/gsd-housekeeping-manager.c @@ +383,3 @@ + /* Create ~/.local/share/applications/, see #703048 */ + dir = g_build_filename (g_get_user_data_dir (), "applications", NULL); + g_mkdir (dir, 0700); why not consolidate this g_mkdir with the g_mkdir_with_parents call above it?
(In reply to comment #8) > Review of attachment 247738 [details] [review]: > > ::: plugins/housekeeping/gsd-housekeeping-manager.c > @@ +383,3 @@ > + /* Create ~/.local/share/applications/, see #703048 */ > + dir = g_build_filename (g_get_user_data_dir (), "applications", NULL); > + g_mkdir (dir, 0700); > > why not consolidate this g_mkdir with the g_mkdir_with_parents call above it? I made a separate call because they address different issues. Say creating the applications folder isn't needed anymore at some point in the future [e.g. because gnome-menus is fixed to monitor non-existing folders (bug #702991) when glib is fixed to not poll non-existing dirs every few seconds (bug #522314)]. Then this call may be removed without noticing that we still need to create ~/.local/share/. I can merge them and make the comment mention both issues it would address. I have no strong opinion on it really.
I guess I don't have that strong of opinion either, in retrospect.
Review of attachment 247738 [details] [review]: Looks good. ::: plugins/housekeeping/gsd-housekeeping-manager.c @@ +381,3 @@ g_mkdir_with_parents(g_get_user_data_dir (), 0700); + /* Create ~/.local/share/applications/, see #703048 */ Put the full link to bugzilla here.
(In reply to comment #11) > Put the full link to bugzilla here. Done. Pushed to master and gnome-3-8.