How to stop Nextcloud from opening when a file dialog or file browser opens

Hi, this is less a support question and more a description of how I fixed the following issue I had:

I use Nextcloud file synchronization on two Fedora 38 AppVMs and was bothered by Nextcloud opening on all other VMs whenever a file dialog or a file browser was opened.

This happens because nextcloud-client registers a dbus service that gets triggered when opening certain file browsers or dialogs as can be gathered from these Nextcloud issues: 1, 2.
You can overwrite dbus services in a variety of folders, for example any folder in $XDG_DATA_DIRS.

But none of the default folders carry over from a Qubes template to an AppVM because they’re in /usr/local or /home. So to disable the nextcloud dbus service system-wide, I added a new folder to $XDG_DATA_DIRS using /etc/environment:

/etc/environment
XDG_DATA_DIRS="/etc/xdg_dbus-1_service_disable:$XDG_DATA_DIRS"

I chose /etc/xdg_dbus-1_service_disable because I think global configurations like this belong in /etc and it carries through to AppVMs.

Then I created the directory /etc/xdg_dbus-1_service_disable/dbus-1/services, copied over the Nextcloud service file from /usr/share/dbus-1/services/com.nextcloudgmbh.Nextcloud.service and changed its Exec line to Exec=/bin/true to make it do nothing, successfully:

/etc/xdg_dbus-1_service_disable/dbus-1/services/com.nextcloudgmbh.Nextcloud.service:
[D-BUS Service]
Name=com.nextcloudgmbh.Nextcloud
Exec=/bin/true

I hope this helps somebody having the same problem. Even if it’s just future-me setting up a new machine and having forgotten how I fixed this.

And if anybody knows a more elegant solution, even better, please share!