I'm running KDE on Arch Linux. I have the following two .desktop
files.
[Desktop Entry]
Comment=First Profile
Exec=firefox --no-remote -P First %u
GenericName=Firefox First Profile
Icon=/path/to/custom/icon1.png
Name=FF_First
NoDisplay=false
Path[$e]=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Comment=Second Profile
Exec=firefox --no-remote -P Second %u
GenericName=Firefox Second Profile
Icon=/path/to/custom/icon2.png
Name=FF_Second
NoDisplay=false
Path[$e]=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
When I initially launch one of these Firefox profiles, the icon that shows up in the task manager bar in Plasma's panel is the custom icon I specified in the .desktop file. But as soon as Firefox has finished starting up, the icon in the task manager (Plasma panel) reverts to the standard Firefox icon. How do I make my custom icon stick in the task manager panel on a per profile basis?
One approach I tried was creating a separate shell script to launch each profile, but that resulted in the same outcome: once Firefox is launched, every profile shows with the same generic Firefox icon in the task manager.
There is a similar question here, but it is not about icons per Firefox profile and it doesn't answer my question.
Update: based on the answer by fra-san, here is my updated desktop entry:
[Desktop Entry]
Comment=Second Profile
Exec=firefox -P Second --class=FFSecond
GenericName=Firefox Second Profile
Icon=/home/allusers/application_icons/Second/Firefox_Logo_128x128.png
Name=FFSecond
NoDisplay=false
Path[]=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
Categories=Network;WebBrowser
X-KDE-SubstituteUID=false
X-KDE-Username=
StartupWMClass=FFSecond
I am not getting results yet. The above entry displays the standard firefox icon in the tabs in the "Task Manager" widget of KDE Plasma's Panel, exactly the same as the standard firefox desktop file does.
I tried the Exec line with -no-remote, with -new-instance and without either and there was no difference in terms of the icon.
As mentioned, I want each Firefox profile to display its custom icon in the tabs in the "Task Manager" widget of KDE Plasma's Panel.
Best Answer
I hope I have understood your question correctly. I assume the icons you are talking of are those of the tabs in the "Task Manager" widget of KDE Plasma's Panel.
It looks like your question has an answer on askubuntu. There, the question mentions Ubuntu and Gnome, but the answer does not make use of any specific feature of a desktop environment or Linux distribution. I tested it on Arch Linux with KDE Plasma 5.14.4, Firefox 63.0.3, X.Org X Server 1.20.3.
It boils down to a couple of edits to your
.desktop
files:1) Add the
--class
option to theExec
key. It is briefly documented on MDN:2) Add the
StartupWMClass
key. It is briefly documented in the Desktop Entry Specification by freedesktop.org:With these two options, each instance of Firefox is given its own
WMCLASS
, so that instances are not grouped together in the "Task Manager". TheStartupWMClass
sets a link between open Firefox windows and the desktop entries that launched them, letting them keep their custom icons.To provide an example, assuming your two
.desktop
files as the starting point and omitting the lines that are not relevant here: