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

Add option to gnome.post_install() to reload the D-Bus configuration? #14202

Open
lawmurray opened this issue Jan 29, 2025 · 0 comments
Open

Comments

@lawmurray
Copy link

I noticed that, when using Meson to install a GNOME app to $HOME/.local, it is possible for .service files not to be picked up by D-Bus, so that one cannot launch the application from the GNOME dash until the D-Bus configuration is reloaded. There is a simple command to fix it, and I wondered whether this would be appropriate to add to Meson's gnome.post_install(), alongside the existing options for rebuilding the icon cache, compiling schemas, etc. It seems like it would be at home there.

I'm working on an app called Mending Wall. Using the following sequence:

meson setup build --prefix=$HOME/.local
cd build
meson compile
meson install

Everything is installed correctly of course: *.desktop files to $HOME/.local/share/applications, *.xml GSettings schemas to $HOME/.local/share/glib-2.0/schemas and *.service D-Bus service files to $HOME/.local/share/dbus-1/services.

However, in the specific circumstance that the $HOME/.local/share/dbus-1/services directory did not exist before the install, D-Bus will not pick up the new service files, as it could not establish a monitor on the non-existent directory when it started (related Flatpak issue here: flatpak/flatpak#3342). So, for example, if you try to launch the app from the GNOME dash, nothing happens. You can see why if you try to launch it via D-Bus from the command line:

gdbus call --session --dest org.indii.mendingwall --object-path /org/indii/mendingwall --method org.freedesktop.DBus.StartServiceByName '{}'  
Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable

The fix is to reload the D-Bus config:

gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ReloadConfig

Now everything works. You can possibly log out and in again too, although this command fixes it immediately.

The app in question has this at the end of its meson.build:

gnome.post_install(
     glib_compile_schemas: true,
    gtk_update_icon_cache: true,
  update_desktop_database: true,
)

That's already doing a lot of post install stuff in the same vein: compiling schemas, updating icon cache, updating desktop database, etc. I wondered whether it's worth adding a Boolean flag that would result in reloading the D-Bus config as well? It could just run the above command when enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants