Ubuntu – How to set default opening folder for Nautilus file manager

defaultdirectorynautilus

How do I configure Nautilus to open at my Documents folder instead of my home folder?

I've scoured this site and found answers instructing users to edit the /usr/share/applications/nautilus.desktop file, replacing %U with the path to the desired default directory. I've edited all the variants of nautilus.desktop in the said directory, but none of the edits has an effect. I've checked all the files after editing them to make sure that I saved the edit effectively, and all look good to me.

I've edited every file to read as follows:

Exec=nautilus --new-window /home/judy/Documents

I've also edited the org.gnome.Nautilus.desktop file, just to be sure, with no joy.

I'm running Ubuntu 15.10.

Note: if I enter nautilus /home/judy/Documents from the command line, Nautilus properly opens in the desired directory. Is there a simple way that I can configure an icon in the launcher bar to run this command and have the Nautilus icon that looks like a metal file drawer?

Thanks. I'm pulling my hair out over this one.

Best Answer

The file that is shown in unity-dash is not anymore /usr/share/applications/nautilus.desktop but /usr/share/applications/org.gnome.Nautilus.desktop.

Changing the Exec= line in the file itself does not have any effect. The problem is an entry DBusActivatable=true that makes the system to run nautilus via dbus. So the Exec= line is being ignored. Maybe it is possible to provide nautilus the desired directory through dbus (/usr/share/dbus-1/services/org.gnome.Nautilus.service) but I am not familiar with that system in detail.
For further information look here: https://wiki.gnome.org/HowDoI/DBusApplicationLaunching

A simple solution for me was to hide the gnome/dbus launcher-icon and make the old one visible again. So add the entry NotShowIn=Unity; to /org.gnome.Nautilus.desktop and comment it out in nautilus.desktop. There you can adjust the Exec= line with the desired directory.

(file: org.gnome.Nautilus.desktop)

[Desktop Entry]
NotShowIn=Unity;     # <--------------------------- add this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window %U
Icon=system-file-manager
Terminal=false
Type=Application
DBusActivatable=true
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
MimeType=inode/directory;application/x-gnome-saved-search;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

#OnlyShowIn=Unity;    # <---------------- comment out this line !

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window
#OnlyShowIn=Unity;    # <---------------- comment out this line !

(file nautilus.desktop)

[Desktop Entry]
#NotShowIn=Unity;     # <---------------- comment out this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window /{DESIRED_DIRECTORY}     # <- adjust !
Icon=system-file-manager
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window