Fixing: Vivaldi opens Nautilus instead of Dolphin on KDE
If you're on KDE with both Dolphin and Nautilus installed, you may have noticed that clicking Open containing folder in Vivaldi (or any Chromium-based browser, really) opens Nautilus instead of Dolphin. Everything else seems fine -- xdg-mime query default inode/directory returns org.kde.dolphin.desktop, and KDE system settings agree. Yet there's the GNOME devs, pushing you their stack even if you don't want it.
One obvious way would be to get rid of GNOME, and I'd argue that would make the most sense. However, if you want to leave it, maybe just because we need to know our enemies, then read on.
Root cause
The key point is that when a browser wants to open a containing directory in the file manager, it doesn't call xdg-open. Instead, it calls the ShowItems method on the org.freedesktop.FileManager1 D-Bus service.
The problem is that both Dolphin and Nautilus ship a D-Bus service file that claims this name:
Nautilus:
/usr/share/dbus-1/services/org.freedesktop.FileManager1.service
Dolphin:
/usr/share/dbus-1/services/org.kde.dolphin.FileManager1.serviceBoth files contain Name=org.freedesktop.FileManager1. When the service isn't already running, D-Bus auto-activates one of them. It picks up org.freedesktop.FileManager1.service first -- because it comes first alphabetically -- and launches Nautilus.
You can verify this by checking the two files:
cat /usr/share/dbus-1/services/org.freedesktop.FileManager1.service
# Exec=/usr/bin/nautilus --gapplication-service
cat /usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service
# Exec=/usr/bin/dolphin --daemonThe fix
D-Bus checks $XDG_DATA_HOME/dbus-1/services/ before the system-level directories. So creating a user-level override is enough:
mkdir -p ~/.local/share/dbus-1/services
cat > ~/.local/share/dbus-1/services/org.freedesktop.FileManager1.service << 'EOF'
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=/usr/bin/dolphin --daemon
EOFThat's the persistent fix. It survives reboots without touching any system files.
If it still doesn't work after creating the file
The service file only matters when the org.freedesktop.FileManager1 name is not yet claimed on the session bus. If Nautilus is already running and holding that name, D-Bus won't re-activate anything -- it'll just keep routing calls to the existing Nautilus instance.
Kill it:
pkill -f "nautilus --gapplication-service"After that, the next time Vivaldi triggers Show in folder, D-Bus will activate Dolphin using your new service file.
Confirming it works
You can test the whole thing without opening a browser at all:
pkill -f "nautilus --gapplication-service"
pkill -f "dolphin --daemon"
dbus-send --session --print-reply \
--dest=org.freedesktop.FileManager1 \
/org/freedesktop/FileManager1 \
org.freedesktop.FileManager1.ShowItems \
array:string:"file:///tmp" string:""Dolphin should open. If Nautilus opens, double-check the service file contents and path.
If that'll work, you still have some work to do. Figuring out why you still have GNOME is a non trivial task. I'm still working on it.
