Firefox profiles with different icons in Ubuntu dock

Edit profile's .desktop file:

  • add --class SomeClass to the end of Exec key to change program's WM_CLASS value (see this article)
  • add new key StartupWMClass=SomeClass to the end of file (see this article and desktop entry specification)

The string SomeClass must be the same in both changes.

Example .desktop file:

[Desktop Entry]
Name=Firefox Test
Exec=firefox -p test -no-remote --class FxTest
Terminal=false
Type=Application
StartupNotify=true
Icon=/path/to/custom/icon.png
StartupWMClass=FxTest