Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm pretty new to Ubuntu, but I know the basics.

I read the "How do I change the folder icons in the “Places” menu?" but it didn't help, did the option #2 since I want to specify it for a single directory (for now).

So what should I do?

I have the folder image as SVG in:

  • /usr/share/icons/hicolor/scalable/apps/
  • /usr/share/icons/hicolor/scalable/places/

The image I want to use:

enter image description here

and where I want it:

enter image description here

share|improve this question
    
What do you mean by "single directory"? Option #2 should do that. –  Alvin Row Mar 9 '11 at 15:56
    
Well, I don't want to change all of the folder icons in the list. I did everything on the option #2, even logged out and in, restarted my computer. But still, it dosen't change the icon. –  Gurnarok Mar 9 '11 at 17:38

1 Answer 1

up vote 10 down vote accepted

The bookmark icons that appear in the places menu can not be changed see: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/423890

But, as you can see the user folders like Videos and Pictures do have a different icon, this is because the places menu only looks at the standard::icon: attribute while customizing a icon only changes the metadata::custom-icon: attribute. There is no way that i have found to change the standard::icon: attribute. This attribute, at a "normal" folder, will always be the same.

A workaround that i have used is changing the directory of a user folder (which i don't use) to the directory of the folder of which the icon must be changed, and after that, replacing the icon files of that user folder.

step 1)

Changing the directory of a user folder can be done by editing the file ~/.config/user-dirs.dirs. You can open it by typing the following line in a terminal window:

gedit .config/user-dirs.dirs

Or by navigation to your home folder press Ctrl+H, search for the folder .config and opening the user-dirs.dirs file from there.

The output of that file will be something 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_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME/Music"
XDG_VIDEOS_DIR="$HOME/Videos"
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PICTURES_DIR="$HOME/Pictures"

Note: before you start editing this file make a backup by saving it with a name like user-dirs.dirs.bak

In this file you can change the directory of your user folders. For example, if you want to change the directory for your Public folder to the directory of your Dropbox folder change the line:

XDG_PUBLICSHARE_DIR="$HOME/Public"

to:

XDG_PUBLICSHARE_DIR="$HOME/Dropbox"

(assuming that your Dropbox folder is located in your home directory)

After you have done this you will notice that your Dropbox folder (if you are using the Ambiance theme) will look like this:

Icon Dropbox/Public

And after you bookmarked it by dragging it to your sidebar in nautilus it will appear in your places menu like this:

enter image description here

If this is not the case try refreshing your window by pressing Ctrl+R or F5, if its still not working at that point check the users-dirs.dirs file for any mistakes you could have made.

step 2)

Although this is a very nice icon it's not the one you wanted to use. You have to replace the icons of the user folder with your own. The icons for the user folder public are named "folder-publicshare.svg" and can be found in:

/usr/share/icons/Humanity/places/16/
/usr/share/icons/Humanity/places/22/
/usr/share/icons/Humanity/places/24/
/usr/share/icons/Humanity/places/32/
/usr/share/icons/Humanity/places/48/
/usr/share/icons/Humanity/places/64/

Because i was bored i made a bash script to make this easy for you

#!/bin/bash
i=0
for d in `ls -d $2*/`
do cp $1 $d$3
echo copying $1 to $d$3
let i++
done
echo "The file $3 was copied to a total of $i locations"

You can copy this in a text editor like gedit and save it in your home folder with the name copy.sh or some other name which you like better. Once you have saved it you have to open a terminal window and type:

sudo chmod +x ./copy.sh

This will make the file you just created executable, to replace the icons type:

sudo ./copy.sh /dir/to/icon.png /usr/share/icons/Humanity/places/ folder-publicshare.svg

Replace the first parameter /dir/to/icon.png with the location of your icon, the second parameter is the parent directory of the folders where the icons are stored, the third parameter is the name of the icons that need to be replaced (this parameter is optional if the script is used for a different purpose).

Using this script will also make a copy to the 128 folder where it isn't needed, it will do no harm there but if you want to delete it you can do this by typing the following line in a terminal window:

sudo rm /usr/share/icons/Humanity/places/128/folder-publicshare.svg

After you logged out and and logged in again this will be the result (in Dutch):

enter image description here

As you can see there is another custom icon in my menu named School (it has my School logo on it), this one replaced the user folder Templates (guess no one really uses that folder). The icons for the user folder Templates are named folder-templates.svg and can be found at the same locations as the icons for the user folder public. While replacing these icons i didn't use the bash script that i posted above but i copied them manually because i made six different icons with different resolutions.

The downside on this approach is that you can only customize a total of seven icons and you have to hand in a standard user folder.

Note: Do not change the directory of your Desktop unless you know what you are doing.

I hope this has answered your question, it may look like a lot of work but its done in a minute.

share|improve this answer
    
Thanks, I made a few modifications on the script (made it make a backup of the folder-publicshare.svg first). –  Gurnarok Mar 13 '11 at 15:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.