Caja is a great file-manager, but one limitation that annoys many is that you can’t customise the toolbar in the Preferences dialogue. And one of the most commonly requested toolbar buttons is the one to Create New Folder. However, you can in fact add new buttons, and remove unwanted ones, and I’ll show you how.
It comes down to specifying toolitems in the config file caja-navigation-window-ui.xml, and wherever you paste the code will determine where the button ends up. For example, if you add the code for your custom button after the entry for the Home button, that’s where it will end up; if you add it after all the default buttons, it will end up on the right end of the toolbar. So you can add your buttons where you want, reorder them as you please, and even get rid of unwanted ones.
Add Create New Folder to Caja’s Toolbar
First off, open the file for editing with the following command:
pluma admin:///usr/share/caja/ui/caja-navigation-window-ui.xml
The second half of the file deals with the toolbar, so locate the button you want to put your custom one after. Hit Enter at the end of that line, and paste the code below into the empty paragraph beneath it, making sure to preserve the indent. For this example, I’m adding the code after the Search button, at the very end of the toolbar, but you can add it wherever you please.
<toolitem name="New Folder" action="New Folder"/>
Once you’ve added your custom button, save the file, then reload Caja (either by manually closing all windows, or running caja -q in the terminal, then opening Caja again). Your new Create New Folder button will be there and ready to use!
Separators, Reordering Buttons & Removing Unwanted Buttons
And if you want to add a separator anywhere, just add <separator/> in between the lines of the buttons (or if you want the reverse, to remove a separator, then delete that line).
If you want to reorder your buttons to your liking, it’s as easy as moving around the lines of code. And, lastly, if there are default toolbar buttons you can do without, simply delete the lines for them. Or, if you’d prefer to comment them out, note that being an .xml file, you can’t use a hash (#) – that results in the entire toolbar disappearing. The correct syntax for XML files is to start the line off with a less-than symbol followed by an exclamation point and two dashes (<!--
), then end the line with two dashes followed by a greater-than symbol (-->
). In the following example, I’m commenting out the “Stop” button (which is useless in my opinion, and just taking up valuable space), and note that since there is already a greater-than symbol (>) at the end, all you need to do is insert two dashes (--
) before it:
<!-- <toolitem name="Stop" action="Stop"/-->
You will see in the file that the line has been successfully commented out:
Once you’ve finished your toolbar tweaks, you will of course need to reload Caja for the changes to take effect.
See also: Full List of Available Caja Toolbar Buttons
☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻
The tutorial above is TOTALLY FREE, and I hope you found it useful! But if this information really made your day, because it rescued you from hours of headache, or allowed you to accomplish something you thought was impossible, then please consider making a donation via PayPal, to buy me a donut, beer, or pizza for my time and effort! Many thanks in advance!
Nice tutorial, thanks. Is it possible to add “open terminal” menuitem in toolbar?
I couldn’t find a way, since the Open in Terminal context menu option comes via a plugin. HOWEVER, I figured out an even better way – I launch the terminal in the current folder simply by hitting the F4 key! I’ll be posting a tutorial on that soon, so follow the blog so you get notifications about updates. Cheers. (PS: My brother is an Attila!)
Thank you for responding to me consanguine! I’ll be waiting for your post.
It’s a nice and instructive blog, congrats! I am from Turkey.
Atilla, just for you I thought I’d get that tutorial happening before I got even busier over the weekend. You can view it via the link below. Once you get it happening, I think you’ll agree this is even better than a toolbar button! Cheers. Frank