Many of you will know how to add new custom places to your Places menu on the panel and bookmarks in your Caja side panel. But, if you don't, then a simple way is to navigate, via Caja, to a given folder and then press CTRL/d (make sure you are inside the given folder when you do this). The folder will then appear as a custom bookmark in your Caja side panel and also as a custom place in your Places menu on your top panel.
What not many people know, however, is how to edit the default bookmarks in your Caja panel and default places in your Places menu. These defaults include, typically, the following:
Home
Desktop
Downloads
Public
Documents
Music
Pictures
Videos
Now, for someone like me, who likes to add a lot of custom bookmarks/places, this can be a bit of a pain. That is to say, in my Caja window, I will have all of the above default bookmarks listed before I even add all of my own custom bookmarks. After I have done so, the total list of places in my places menu and bookmarks in my Caja side panel can be excessive. This, in turn requires that I am having to constantly scroll down my side panel past all of the default places to find my custom places. See below:
So, I have figured out how to remove most of my default bookmarks/places. I am about to show you how to do that. But, I will preface that explanation with the following caveat. For experienced users, doing the following will be no problem. For new users, it should be no problem so long as you are careful. But, messing about with config files can be a sometimes go wrong and, if you are a newbie and are not confident or have a low risk-tolerance, then don't do it.
Anyway, here is how to do it:
-
Open Caja. It will open in your home folder. Press CTRL/h. This will show all of your hidden folders and files. Open the .config folder. Inside there, is a file called "user-dirs.dirs". Right click the file and select "copy". Then, navigate to back up one folder into your home folder and paste the file there (or, indeed, anywhere else you want to really, so long as you know where you pasted it).
-
Open the copy you made of of the file. It will look like this:
This file is written by xdg-user-dirs-update
If you want to change or add directories, just edit the line you're
interested in. All local changes will be retained on the next run
Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
absolute path. No other format is supported.
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
You can see, at the bottom of the file, all of your default places/bookmarks. If you put a # in front of all of these, it disables them. Now, I know you may be thinking, "but I want my home folder and, perhaps, my desktop folder to remain in the places/bookmarks menu". Well, don't ask me how, because I don't know how, but I have found out, through trial and error, that if you precede all of these entries with a #, then all of your superfluous places/bookmarks (downloads, videos, public etc) will disappear. But, you will still be left with the Home folder and Desktop folder in your places menu on your panel and you will still be left with your Home, Desktop, File system and Wastebasket bookmark in your Caja side panel. So I am guessing these are thoroughly hard-wired into Caja, no matter what edits you make to this file. Which is all fine, for me, because I would have still wanted those anyway.
The second question I am anticipating is "Why do this to a copy of the "user-dirs.dirs" file? Why not do it to the original?". Well, again, I don't know why. But, I have found out, through trial and error, that if you do this to the original file, it gets overwritten with a default version of it at every login. So, the following is how to get around that. It involves making a bash script to be run at login:
Firstly, precede your entries in your (copy of the) file. It should look like this:
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
#XDG_DESKTOP_DIR="$HOME/Desktop"
#XDG_TEMPLATES_DIR="$HOME/Templates"
#XDG_DOWNLOAD_DIR="$HOME/Downloads"
#XDG_PUBLICSHARE_DIR="$HOME/Public"
#XDG_DOCUMENTS_DIR="$HOME/Documents"
#XDG_MUSIC_DIR="$HOME/Music"
#XDG_PICTURES_DIR="$HOME/Pictures"
#XDG_VIDEOS_DIR="$HOME/Videos"
Then save the file.
-
Now open a blank Pluma file and copy and paste the following into it:
sleep 3
cd /home/stephen/.config
rm user-dirs.dirs
cd /home/stephen/my-bash-scripts
cp user-dirs.dirs /home/stephen/.config
killall caja
The first line is to hold this bash script back a bit so that it does not end up in a race condition (conflict with other startup scripts).
The second line is to navigate to where the original configuration file is. My user name is "stephen". Your's, obviously, will be different and so you will need to modify this line accordingly.
The third line is remove the file
The fourth line is to navigate to where you have the copy stored. Mine is stored in a folder called "my-bash-scripts". Yours may be stored elsewhere. So, you would need to amend this line accordingly.
The fifth line copies the amended version of the configuration file (with the extra # prefixes in) to the .config folder to replace the one that was deleted.
The sixth line restarts Caja to enable the new configuration.
Now save the Pluma file in your home folder somewhere as "reset-caja-default-places.sh.
Then right-click this file and choose "properties" and select the "permissions" tab. See below:
Check the "allow executing file as program" check-box. Then, close the "properties" dialog box.
- Now go to system/preferences/personal/startup applications and click on the "add" button.
Type what you want in the "Name" field.
Use the "browse" button to navigate to where you have saved your bash script and select it. Its path will then appear in the "command" field.
Click the "add" button to complete.
Then close the Startup Applications main dialog box.
Okay, if you now log out and then back in you should find your Places menu and Caja folder will only show the bare-bones default places I described earlier. See below:
Modified default places menu on main panel
Modified Caja default bookmarks on Caja side-panel
To undo all of the above, just go to your startup application and delete the startup entry that you just made from the list of startup apps. Then, edit the "user-dirs.dirs" file in your .config folder and remove the # prefixes from the relevant entries. Then log out and back in.