How to change device icons in launcher?
I'm running Ubuntu 13.04 and I have several hard drives in my computer and all appear with the same icon in the launcher. Is it possible to modify their icons one by one or at least change their color to better find what I'm looking for?
You can use udev rules to match with your devices and then assign an icon.
NOTE: In this example I will change the icons for 3 devices, usb pendrive, partition with Opensuse and a partition (Raid) with Linux Mint.
For Ubuntu 12.10 and Newer.
1) I have 3 icons in my Desktop for each device (2 png and 1 svg images), copy the 3 icons to the /usr/share/pixmaps
folder and give them perms.
cd ~/Desktop
sudo cp linuxmint.svg pendrive.png opensuse.png /usr/share/pixmaps/
cd /usr/share/pixmaps/
sudo chmod 644 linuxmint.svg pendrive.png opensuse.png
2) List the usb pendrive to know the "idVendor" and "idProduct", in a Terminal type:
lsusb
Write down the numbers after "ID".
In my example:
Bus 002 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
The "idVendor" is 0930 and the "idProduct" is 6545
I'm going to match that info with the "ATTRS{idVendor}" and "ATTRS{idProduct}" keys for my usb Pendrive.
3) Make sure your partitions are mounted, then list your partitions and find the attributes.
df -h
In my example:
/dev/sdc3 289G 6.3G 282G 3% /media/hermes/OpenSuse
/dev/mapper/pdc_cjjfccgf3 296G 68G 213G 25% /media/hermes/Linux-Mint-Raid
4) List the attributes of the OpenSuse partition with "udevadm info -a -n device name"
udevadm info -a -n /dev/sdc3
You can use this info to match the partition.
In this example I'm going to match with the "KERNEL" and "SUBSYSTEM" keys for the OpenSuse.
KERNEL=="sdc3", SUBSYSTEM=="block"
Write down this info.
5) In case of the Linux-Mint-Raid partition, I'm goin to match the rules with the "SUBSYSTEM", "ATTR{size}" and the "ID_FS_LABEL" ENV variable.
List the attributes and variables of the Linux-Mint-Raid partition with "udevadm info -a -n device name" and "udevadm info -q all -n device name".
udevadm info -a -n /dev/mapper/pdc_cjjfccgf3
udevadm info -q all -n /dev/mapper/pdc_cjjfccgf3
Creating the udev rule.
6) Go to the /etc/udev/rules.d folder and create a file with your favorite editor.
eg: 99-devices-icons.rules
cd /etc/udev/rules.d/
sudo nano 99-devices-icons.rules
Write down the info to match each device and then with the ENV{UDISKS_ICON_NAME} you will assign an icon.
In my example:
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_ICON_NAME}="pendrive" KERNEL=="sdc3", SUBSYSTEM=="block", ENV{UDISKS_ICON_NAME}="opensuse" SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_ICON_NAME}="linuxmint"
In nano you can save the changes with:
- Ctrl +O,Enter then Ctrl +X
7) To refresh the udev rules and see the changes, type in a Terminal window:
sudo udevadm trigger
For Ubuntu 12.04.
The same but you should assign the icon with ENV{UDISKS_PRESENTATION_ICON_NAME} instead ENV{UDISKS_ICON_NAME}
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_PRESENTATION_ICON_NAME}="pendrive"
KERNEL=="sdc3", SUBSYSTEM=="block", ENV{UDISKS_PRESENTATION_ICON_NAME}="opensuse"
SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_PRESENTATION_ICON_NAME}="linuxmint"
Hope this helps.