0

While this question is a precise duplicate of another (How do I add new locations to "Files" launcher in Ubuntu dock?), I believe that it has been incorrectly marked as duplicate, and has never been satisfactorily answered. Therefore I am repeating it.

The supposed duplicate (How do I pin my favorite folders in Ubuntu dock like in Windows?) concerns pinning one location to the launcher. This question is about having several locations available under one 'files' entry on the launcher.

Can someone please give a step by step description of how to achieve this in 18.04.

0

In principle, one can add items to the right-click menu of a Dash launcher in Gnome-Shell by defining extra "Desktop Actions" in the .desktop file. To see this working, copy the .desktop file of Files (Nautilus), /usr/share/application/org.gnome.Nautilus.desktop to your hidden folder .local/share/applications. After that, you can edit the local desktop file without the need to be root and without affecting other users of your system. This local copy will replace the system wide version on your launcher.

If you open your local .local/share/application/org.gnome.Nautilus.desktop file in a text editor, you will already see an example of such action at the end of the file:

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

This action represents the "New Window" item in the right-click menu of the launcher. Note that this action is declared earlier in the file, on the line Actions=.

Thus, you easily can add your custom action:

[Desktop Action places-documents]
Name=Documents
Exec=nautilus /home/yourlogin/Documents
  • Name the action like you want. I choose places-documents.
  • The 'Name=' item is what appears in the menu.
  • You need to specify the full pathname: this mechanism apparently does not support shell variables ($HOME) or shell expansion (~). Thus, substitute your actual login instead of yourlogin.

Add your action to the Actions= line:

Actions=new-window;places-documents

We would be ready if it were not that apparently, the command to open a folder will not work. At least it did not for me. This is apparently due to nautilus communicating through dbus. After changing the line DBusActivatable to false, it works for me:

DBusActivatable=false

I do not know potential side effects of disabling the communication of Gnome Shell with nautilus through dbus. As long as you do not encounter side effects that are unacceptable to you, you will be good to go.

|improve this answer|||||
  • Thank you vanadium. I found that if I deleted nautilus.desktop and org.gnome.Nautilus.desktop from /usr/share/applications and replaced nautilus.desktop with a version in ~/.local/share/applications then I did not need to change DBus setting. I did not replace org.gnome.Nautilus.desktop. I'd be interested to know why there are 2 very similar desktop files. And why one has a capital 'N'. The fact they both display with the name 'Files' in /usr/share/applications doesn't make life easier. I opened them in gedit to find out which is which. – Pansmanser Oct 12 '19 at 11:24
  • Thank you for the feedback. I do not have nautilus.desktop on 19.04, a system upgraded from older versions, though (no fresh install). One of these two might be used to autostart nautilus. This is not anymore done in 19.04 because nautilus does not anymore provide the active desktop. – vanadium Oct 12 '19 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.