For what it’s worth, my go-to solution for customizing task manager icons is using Window Rules in KWin to match the window in its “in use” state, and then force a desktop file name to match a desktop file set to the icon I want.
At least for how I use my device, that has the advantage of working regardless of how that window comes to be - restored Firefox session, launched from app launcher, or any other way.
As an example, my Todoist desktop entry, named todoist.desktop
:
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Todoist
GenericName=To-Do List Manager
Exec=firefox --new-window "https://app.todoist.com"
Icon=todoist
Categories=Office;
And the KWin window rule that corresponds:
[Firefox Todoist]
Description=Firefox Todoist
desktopfile=todoist
desktopfilerule=2
title=Todoist — Mozilla Firefox
titlematch=2
types=1
wmclass=org.mozilla.firefox
wmclasscomplete=true