Nautilus not working properly due to missing PATH in dbus

I am using Hyprland with wofi to run apps.
When I open nautilus using wofi, it cannot find any app to open files (except VLC, for some reason I have no clue why). If I go to the “Open With…” dialog, only VLC is present.

Apparently, this is due to the PATH env var missing in dbus, since if I do dbus-update-activation-environment PATH then nautilus works as expected.

Is there something that I am missing to make this work without having to explicitly import PATH?

Your desktop environment should run that program, otherwise D-Bus activated applications will not have access to your session environment.

For window managers, the display manager session script does it:

But if you do not use a display manager, you will need to call it yourself.

1 Like

Actually, it looks like Hyprland does call dbus-update-activation-environment, it just does not include PATH and XDG_DATA_DIRS, which are necessary for application launchers and file associations.

There is an upstream issue about that: Import environment variables into systemd in NixOS modules · Issue #2800 · hyprwm/Hyprland · GitHub Also Xwayland applications don't startup when launching them from `nautilus` · Issue #2965 · hyprwm/Hyprland · GitHub

1 Like

Thanks! I don’t know how I missed those two issues.
I was a bit afraid that passing PATH to dbus was not the proper thing to do, but if it is ok, then I’ll just do that. Thanks!

Actually, I just noticed that you said “But if you do not use a display manager, you will need to call it yourself.”.
I do use GDM, so it should do that for me?

I meant that if your desktop environment does not do it and you use display manager, you can use services.xserver.updateDbusEnvironment NixOS option to have the session script generated by the display manager NixOS module do it for you.

Ohh, right! That works!
Thanks a lot once again.

I have sway configured via Home-manager.
I’ve tried running dbus-update-activation-environment --systemd --all from a terminal and then start nautilus, it can’t find much mimetypes mappings.
What puzzles me is that gio launched from a terminal seems to find libreoffice (writer.desktop)

$ gio mime application/vnd.oasis.opendocument.text  # for .odt documents
Application par défaut pour « application/vnd.oasis.opendocument.text » : org.gnome.BrowserConnector.desktop
Applications inscrites :
	org.gnome.BrowserConnector.desktop
	writer.desktop
	xarchiver.desktop
	org.gnome.FileRoller.desktop
	org.gnome.Nautilus.desktop
Applications recommandées :
	org.gnome.BrowserConnector.desktop
	writer.desktop
	xarchiver.desktop

but in nautilus it can’t find any application to open it, writer.desktop doesn’t even appear in the list of applications I can start manually :cry:

Have you tried the solution here ?

Also mentioned here in hyprland doc with home-manager: Hyprland on Home Manager – Hyprland Wiki

wayland.windowManager.hyprland.systemd.variables = ["--all"];