To re-order the Places list in Thunar, you must edit the bookmarks.xml file located in your user configuration directory. This XML file explicitly defines the sequence of shortcuts displayed in the sidebar. By modifying the order of entries within this specific file and restarting Thunar, you can customize the layout to match your preferred workflow without relying on third-party tools or incorrect configuration files.
Understanding the Configuration File
Thunar, the default file manager for the Xfce desktop environment, manages its sidebar shortcuts through a dedicated XML configuration file. Many users mistakenly attempt to modify context menu actions or other settings, but the visual order of the "Places" panel is strictly controlled by the bookmarks database. The correct file to edit is~/.config/Thunar/bookmarks.xml.
This file contains a series of <bookmark> elements. Each element represents a shortcut pinned to the sidebar. The position of these elements in the file directly corresponds to their display order in the graphical interface. The first bookmark listed appears at the top of the sidebar, while the last one appears at the bottom. Understanding this direct mapping is crucial for manual customization. If you add new shortcuts via the GUI, they are appended to the end of this file by default, which often disrupts your desired organization.
Locating and Backing Up the File
Before making any changes, it is essential to locate the file and create a backup. This ensures that you can restore your previous configuration if something goes wrong during the editing process.- Open your terminal application.
- Navigate to your home directory or use an absolute path reference.
- Create a backup copy of the current configuration using the following command:
cp ~/.config/Thunar/bookmarks.xml ~/.config/Thunar/bookmarks.xml.backup
This command creates a duplicate file with a .backup extension. You can verify the backup exists by listing the contents of the Thunar configuration directory. If you need to revert changes, simply delete the modified bookmarks.xml and rename the backup file back to its original name.
Editing the Bookmarks Order
You can edit the file using any plain text editor, such asnano, vim, or even a graphical editor like Gedit. For this guide, we will use nano due to its simplicity and widespread availability.
- Open the file in the terminal:
nano ~/.config/Thunar/bookmarks.xml
The file structure consists of a root <bookmarks> tag containing multiple <bookmark> tags. Each bookmark has two primary attributes: href, which specifies the actual file system path (using the x-file:// URI scheme), and name, which is the label displayed in the sidebar.
To reorder the shortcuts, you need to cut and paste entire <bookmark> blocks. For example, if you want a folder named "Documents" to appear above "Downloads," find the <bookmark> block for Documents and move it physically higher in the file than the Downloads block.
<bookmarks>
<bookmark href="x-file:///home/user/Documents" name="Documents"/>
<bookmark href="x-file:///home/user/Downloads" name="Downloads"/>
</bookmarks>
After rearranging the lines, save the file. In nano, you can do this by pressing Ctrl+O followed by Enter, then exit with Ctrl+X.
Adding New Shortcuts Manually
If you wish to add a new shortcut manually rather than through the GUI, you can insert a new<bookmark> line into the file. Ensure you use the correct URI format. Standard file paths must be prefixed with x-file://. For instance, to add a project folder at /home/user/projects, add the following line in your desired position:
<bookmark href="x-file:///home/user/projects" name="Projects"/>
Be careful not to introduce syntax errors, such as missing quotes or unclosed tags, as Thunar may fail to parse the file correctly.
Applying the Changes
Thunar does not always refresh its configuration dynamically when the file is saved. To ensure the new order takes effect, you should restart the file manager. The easiest way to do this is to close all open Thunar windows. If Thunar is running in the background, you may need to kill the process. In the terminal, run:pkill thunar
Then, launch Thunar again from your application menu or by typing thunar in the terminal. You should now see your shortcuts arranged in the order specified in the bookmarks.xml file.
If the changes do not appear immediately, try clearing the Thunar cache by deleting the ~/.cache/thunar directory, although this is rarely necessary for simple reordering tasks. Note that if you subsequently add or remove bookmarks via the right-click context menu in Thunar, the GUI tool will rewrite the bookmarks.xml file, potentially resetting your custom order. Therefore, it is best to perform all reordering manually via the text file if you require precise control.
For related issues regarding how Thunar handles specific directories, you might find Thunar Quick Link to Downloads not Updating After Changing Default Downloads Directory helpful if you are also adjusting where files are stored.
Frequently Asked Questions
Why did my custom order reset after adding a new bookmark?
When you add a bookmark using the Thunar GUI (right-click > Add Bookmark), the application writes directly to bookmarks.xml and typically appends the new entry to the end of the file. This action overwrites your manual ordering. To maintain a custom order, avoid using the GUI to add new items once you have set up your preferred sequence, or re-edit the file after every GUI change.
Can I use a graphical tool to reorder Thunar bookmarks?
There is no built-in drag-and-drop feature in Thunar's preferences to reorder the Places list. While some extensions or third-party scripts exist, the most reliable method remains editing the bookmarks.xml file directly. Using a text editor gives you full control over the exact sequence and allows you to edit names and URIs precisely.
What happens if I make a syntax error in the XML file?
If bookmarks.xml contains invalid XML syntax, Thunar will fail to load the bookmarks pane. The sidebar may appear empty, or Thunar might refuse to start. This is why creating a backup before editing is critical. If this occurs, restore the backup file from bookmarks.xml.backup to regain functionality.
Does this method work for other Xfce applications?
No, this method is specific to Thunar. Other Xfce applications manage their own configuration files separately. For example, window manager shortcuts are handled by xfwm4 settings, and panel configurations are stored in different XML structures within ~/.config/xfce4. Always check the specific documentation for the application you are trying to configure.
How do I remove a bookmark if I don't want to edit the file?
You can remove a bookmark by right-clicking it in the Thunar sidebar and selecting "Remove". However, as noted, this triggers a GUI write operation that may disrupt your manual order. If you prefer not to use the GUI, simply delete the corresponding <bookmark> line from bookmarks.xml and restart Thunar.