Pin folders to the context menu of the 'Files' icon in the Ubuntu 20.04 dock

about anchor folders contextual menu

In the next article we are going to take a look at how we can anchor the folders that we use the most to the context menu of the 'Files' icon that appears in the Ubuntu 20.04 dock. This is something that other operating systems allow to do easily, since in those systems the user can right-click on the icon 'File Browser'in the panel, and you can quickly access pinned folders (Desktop, Downloads, etc ...) without having to open our user folder first.

Ubuntu implemented this feature in Ubuntu 21.10 for the first time. Ubuntu 20.04 users can manually add the folders we work with the most to the context menu that appears when right-clicking on the 'Files' icon found in our system's dock.. In this way we can choose to open our favorite folders quickly.

Pin custom folders to the context menu of the 'Files' icon located in the Ubuntu 20.04 dock

To achieve this, it is only necessary to follow some simple steps indicated in ubuntuhandbook.

Copy the .desktop file from the file manager to the local folder

The Ubuntu file manager shortcut icon is handled by the .desktop file, which is located in the 'directory/ usr / local / applications'. It is recommended to copy this file to the local user directory, so the changes will only work for the current user.

To begin we are going to open a terminal (Ctrl + Alt + T). In it it is only necessary use the following command to copy the file to the local directory using command:

sudo cp /usr/share/applications/org.gnome.Nautilus.desktop ~/.local/share/applications/

Since the file we just pasted into the local directory is still owned by root, we are going to change the property executing in the same terminal the command:

copy desktop file to local

sudo chown $USER:$USER ~/.local/share/applications/org.gnome.Nautilus.desktop

When using the above command, The variable $ USER will print the name of the current user.

Edit the .desktop file and add more actions

The next step to follow will be edit the .desktop file by running in the same terminal the command:

vim ~/.local/share/applications/org.gnome.Nautilus.desktop

This command will open the file in the vim editor. Here everyone can use their favorite text editor. When it opens, it will only be necessary to follow the following steps:

The first thing is going to be locate and comment the line DBusActivatable = true. To do so, it is only necessary to add '#' at first.

comment out dbusactivatable

Now let's add more values ​​to 'Actions', such as downloads, documents, videos, images and whatever everyone wants. These values ​​must be separated by semicolons (;) without blank spaces.

In addition to the above, we will also have to add the segments "[Desktop Action Downloads] ”,“ [Desktop Action Documents] ”,“ [Desktop Action Videos] ”,“ [Desktop Action Images] on the bottom. And below each segment it is necessary to add:

'Name' → The name to be displayed in the context menu.
'Exec' → The command to open the folder that interests us. Generally the command will be something like Nautilus / home / USERNAME / folder

An example of some basic folders that can be added would be:

edit desktop file

Actions=new-window;descargas;documentos;vídeos;imágenes;

[Desktop Action new-window]
Name=New Window
Exec=nautilus --new-window
[Desktop Action descargas]
Name=Descargas
Exec=nautilus /home/nombre-usuario/Descargas
[Desktop Action documentos]
Name=Documentos
Exec=nautilus /home/nombre-usuario/Documentos
[Desktop Action vídeos]
Name=Vídeos
Exec=nautilus /home/nombre-usuario/Vídeos
[Desktop Action imágenes]
Name=Imágenes
Exec=nautilus /home/nombre-usuario/Imágenes

In the above code, it is necessary for each user to change 'username' to the name of their user. It is necessary to clarify that folders do not have to be located in the user's folder. After adding all the folders that we want to add, all that remains is save the file.

Restart Gnome Shell to apply the change

restart gnome-shell

After saving the file, you need restart gnome shell. In the default Xorg session of Ubuntu 20.04, it is only necessary press the key combination Alt + F2. In the window that will be displayed on the screen, it is only necessary press the key r and press Intro.

folders will anchor the 'Files' icon of the Ubuntu 20.04 dock

After restarting Gnome Shell, in the icon 'Archives'which is located in the Ubuntu dock, If we right-click, it should use the .desktop file located in the user's directory and it will offer us the quick access folders that we establish.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.