2

Is there a way to add custom folders to the left bar of the XDG file dialog in Linux? How?

Below is a screenshot of the file dialog from my Firefox under Kubuntu 20.04, with plasma-browser-integration package installed. As I understand, this is the XDG portals file dialog? I'm talking about the area marked with the red arrow. I want to add some other folders there, for quick access.

File dialog

2 Answers 2

5

After a bit more experimenting, found the answer:

In the particular dialog in this screenshot, find the folder you want to add in the main area, select and right-click it, then Add to Bookmarks.

This creates a file ~/.config/gtk-3.0/bookmarks, which just lists the bookmark paths one on each line:

file:///path/to/folder1
file:///path/to/folder2

Based on the file path of this file, I guess this isn't actually the XDG file dialog.

Kate and Konsole use a different dialog, where you can just right-click the Places area and choose Add Entry. This edits the ~/.local/share/user-places.xbel XML file.

2

This is specifically the GNOME (GTK 3) file dialog (using the Breeze-GTK theme, apparently).

The "XDG Portal" system allows each desktop environment to provide its own implementation of these dialogs – the same portal-using program can have a GTK 3 file dialog when in GNOME when "xdg-desktop-portal-gtk" is running but will have a Qt-based file dialog when in KDE-Plasma when "xdg-desktop-portal-kde" is running.

Also, programs that are not using the XDG Portal system will always use the dialog provided directly by whatever toolkit that program is written in. So if the portals facility is not available, programs built on GTK 3 will always use the dialog built into GTK itself regardless of the environment.

You cannot pin anything to the topmost section in the GTK 3 file dialog; it only lists the standard "XDG User Directory" locations (although those can be relocated through ~/.config/user-dirs.dirs).

There is however a separate bookmarks section below the mounted locations – you can right-click any folder in the file dialog and select "Add to bookmarks". If your system has Thunar (from Xfce) or a GTK 3-based version of Nautilus (the GNOME file manager), they also share the same list of bookmarks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .