Caja is a great file-manager, and unlike Nautilus it still has a toolbar, but one limitation is that you can’t customise the toolbar in the Preferences dialogue. 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 buttons end up. For example, if you add the code for your custom buttons after the entry for the Home button, that’s where they will end up; if you add them after all the default buttons, they 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.
And here I’ll show you how to add 4 different buttons related to the deleting of files and managing the Trash/Rubbish/Bin (the naming of that folder can vary: in most screenshots of Caja I’ve seen it is Trash, whereas when I first installed Caja in KDE it was Bin, but when I log into my MATE desktop it’s displayed as Rubbish – so I’ll go with Trash in this tutorial, especially since that’s the term used in the code we’ll be adding).
These will be Open Trash, Move To Trash, Delete (bypass Trash and completely delete), and Empty Trash.
While it’s easy enough to hit the Delete key to move files and folders to the Trash, and to totally delete them it’s just Shift+Delete, having buttons for these can save you reaching for the keyboard if you’ve just selected files/folders with your mouse (I’ve found the Delete button to be more useful than I imagined). And while you can right-click Trash in Caja’s sidebar and choose Open, Open in New Tab, Open in New Window, and Empty Trash, having a button to open it in the current tab – or middle-click that button to open the Trash folder in a new tab (very handy!) – is quicker, and I’ve found the ability to empty the Trash simply by clicking a button to be extremely useful.
Adding the Delete & Various Trash Buttons
Here I’ll show you how to add all 4 buttons, but you can of course leave out buttons you have no use for, as well as rearrange their order. Personally, I don’t have one for Move to Trash (simply “Trash” in the code below), as hitting the delete key is quicker, but having one for Delete saves me from using both hands to hit the Shift+Delete combo. I middle-click the Open Trash button (“Go to Trash”) to open it in a new tab quite often, but leave that out if you don’t think you’ll use it. But most of us will probably find being able to Empty Trash via a toolbar button to be quite handy.
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 ones 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 (if pasting the whole block at once, you’ll need to hit the spacebar a few times before the second line onwards so the indents line up).
<toolitem name="Go to Trash" action="Go to Trash"/>
<toolitem name="Trash" action="Trash"/>
<toolitem name="Delete" action="Delete"/>
<toolitem name="Empty Trash" action="Empty Trash"/>
Personally, I put these near the end of the toolbar, but you can add them wherever you please.
Once you’ve added your custom buttons, 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 toolbar buttons will be there and ready to use!
For info on how to Add or Remove Separators, Reorder Existing Buttons, and Remove Unwanted Buttons, check out this guide!
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!
Excellent tutorial. I followed your instructions and i added, removed, rearranged the buttons in Caja toolbar. Everything is as expected except for one thing: for some reason it is impossible to add the “Delete” button. The “Go to Trash”, “Trash” and “Empty Trash” install just fine but not the “Delete” button. By the way, i am using Caja 1.24.0. Any clue why this is happening?
That’s weird – I’m using the same version, and all is fine. What is happening when you add the code? If the code is correct – – then it should work! If it’s not ending up in an overflow menu on the far-right due to having too many buttons for the current window size, then I have no idea what is going on. Give me as much detailed info on what is happening, and I’ll see if I can help.
Thanks for the quick reply. Nothing strange happened while adding the code, all actions i did (add-remove-reaggange buttons) worked like a charm. Except for the Delete button. It’s weird… Here ‘s the toolbar section of my caja-navigation-window-ui.xml file:
Thanks for the quick reply. Nothing strange happened while adding the code, all actions i did (add-remove-reaggange buttons) worked like a charm. Except for the Delete button. It’s weird… Here ‘s the toolbar section of my caja-navigation-window-ui.xml file:
Looks like code gets deleted from comments – it did in my reply, which had the line for Delete. But as long as you had the code as-is, it should have worked – it has for other people. Can you give me detailed info on what is happening, what you’re seeing? Like, if you put it in between other buttons, is there a space there? If that’s the case, it could be that the icon theme you’re using doesn’t have an icon for Delete (though you would expect some generic icon to show up). Also, if there are other buttons after delete, are they showing up? Because when Caja doesn’t like some code, all buttons after (to the right of) that code won’t show up either. So my experience has been that either a button shows up fine, as do all the buttons after it, or it doesn’t show up, and neither do any buttons after it. If you’ve put the Delete code after everything else, ie at the end of the toolbar, then move it in between other buttons and see what happens. And also, if it already is between other buttons, and you see a space there, see if it actually is there, but is basically invisible because it has no icon.
I have tried everything you proposed (placing fewer buttons, changing the Delete button position, trying several icon themes, etc.). There was no blank space in any case. I thought of a lesser importance to mention the fact i am using MX Linux minimal with Mate installed on top of it. I couldn’t find any explanation why this was happening and i thought maybe it has to do with Mx Linux. So i tried to do the same on another Debian based distro (Spiral Linux) and behold… there it was the Delete button!! Then, i did the same on Linux Mint LMDE5 Mate and MX Linux Mate, all live instances all with success. So i guess something is missing on MX Linux minimal with Mate desktop and was causing all this trouble. Nice ending => all good! Thanks a lot for you time. A new install is on its way:)
Glad to see you got it sorted! Though still can’t get my head around why that would be happening, considering Caja and MATE would be the default packages in the repos. Anyway,at least you got it happening. Cheers.