This can be done using the free AutoHotkey.
Create a .ahk
text file and enter these contents:
#Persistent
SetTitleMatchMode, 2 ; A window's title to contain the text anywhere
F9::
ChangeWindowIcon("title text", "\path\to\iconfile.ico")
ChangeWindowIcon(WinSpec, IconFile) {
hIcon := DllCall("LoadImage", uint, 0, str, IconFile, uint, 1, uint, 0, uint, 0, uint, uint 0x10)
if (!hIcon) {
MsgBox, "Icon file missing or invalid in `nChangeWindowIcon(" IconFile ", " WinSpec ")`n`n"
Throw "Icon file missing or invalid in `nChangeWindowIcon(" IconFile ", " WinSpec ")`n`n"
}
hWnd := WinExist(WinSpec)
if (!hWnd) {
MsgBox, Window Not Found
return "Window Not Found"
}
SendMessage, WM_SETICON:=0x80, ICON_SMALL:=0, hIcon,, ahk_id %hWnd% ; Set the window's small icon
SendMessage, WM_SETICON:=0x80, ICON_BIG:=1, hIcon,, ahk_id %hWnd% ; Set the window's big icon
SendMessage, WM_SETICON:=0x80, ICON_SMALL2:=2, hIcon,, ahk_id %hWnd% ; Set the window's small icon
}
The script is set to be activated upon hitting F9, but you may set
your own key. Add as many calls to the function ChangeWindowIcon
as required,
each with the parameters of:
- Unique text that can be found in the title
- The full address of an icon file
When the script is running, you may right-click its green H icon in the traybar
and choose Exit to terminate. If it works, you may also add it to your
Startup group to run when you login.
Note that AutoHotkey can also launch your favorite tabs and arrange their
layout on the screen. There isn't really much that AutoHotkey cannot do.
Do you mean you have pinned items to the taskbar, and have you tried right-click > Properties > Change icon? – harrymc – 2019-01-15T08:16:48.343
@harrymc With that I can only change the icon of all Firefox windows to the same icon. What I would like to achieve is during an open session that each opened windows should have a different icon. I think this cannot be achieved on a system level (since the respective windows' titles change depending on the active tabs), so the question is whether it is possible from within Firefox somehow, probably via an addon. – Tobias Kienzler – 2019-01-15T09:00:17.047
How do you handle your contextual windows? Do you run separate profiles or do you just have a single one? – Seth – 2019-01-15T09:11:22.730
@Seth Just a single one. Using separate profiles sounds like an interesting approach, though now I'm just starting to use Firefox' containers, which seems less of a hassle to me – Tobias Kienzler – 2019-01-15T10:11:32.100