A clean way to disable dbus in the context of a process
In some cases, an application may want to prevent a connection to dbus without being able to change the connection attempt itself. This could be in case an admin wants to temporarily disable the use of dbus for a specific application as a workaround for an issue or because an application uses a feature that automatically uses dbus without having the option to disable it.
Currently I am looking at the second case in the context of building a native sandbox for zathura and this brings some unexpected challenges since gtk by default initiates a dbus connection that is available inside the sandbox. Details: https://git.pwmt.org/pwmt/zathura/-/merge_requests/65
GTK does not provide a way to disable their native dbus, but they also don't mind if the connection is blocked like flatpak does: https://gitlab.gnome.org/GNOME/gtk/-/issues/4842
The only way to block this without starting the whole process inside a container that isolates the socket path and network namespace seems to be to set the session bus address to an invalid path like this: https://git.pwmt.org/pwmt/zathura/-/merge_requests/65/diffs
In order to allow for a clean solution to this problem, it would be great to have a way to disable the dbus connection attempt through an intended mechanic that is also more reliable that using environment variables.
Thank you.