I'm using Win7 but looking for a cross os solution, but this isnt even working in my Win7. I'm trying to change the icon of just the current profile. So what i did was:
How can I change this icon?
Thanks
Here's another topic i made on ask.m.o trying to ask the same thing: https://ask.mozilla.org/question/725/custom-icon-per-profile/
If you don't like using resource hacker and modifying the exe, you can use the change icon setting by right clicking Firefox shortcut from C:\ProgramData\Microsoft\Windows\Start Menu\Programs and setting it to the old firefox icon.
Right-click on the new shortcut and select Properties. On the Shortcut tab, type a space after the Target and then type: -p <profile name>, replacing “<profile name> with the name of the profile you want to use. For example, I created a profile called LoriWork so I added -p LoriWork to the end of the Target. Click OK.
Hi KensPC, your second icon is the more common installation location.
Tap and hold any empty spot on the Home screen. Scroll down and select the Firefox app from the list. You can scroll through the available widgets by swiping left and right. When you find the one you'd like to add, click the + Add Widget button.
WebExtensions do not permit the window icon to be changed from an extension.
The combination of the title of your question and the text of your question make it unclear what you desire to accomplish.
If your goal is to dynamically change the window icon of a currently running Firefox process then you will need to follow something along the lines of the second or third method listed in nmaier's answer.
If you goal is to always have a different, static icon used for the primary Firefox windows for a specific profile, that is quite easy.
You will need icon files of the appropriate format for each architecture for which you desire this to work.
The following assumes Windows, it is easily expanded to other architectures by including an icon file with the same name, but appropriate file extension and format.
Create a simple overlay, extracted extension. You will need a minimum of 2 files:
Example, fully functional, install.rdf:
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:version>1.0.0</em:version>
<em:name>Window icon change</em:name>
<em:description>Change the Firefox main window icon.</em:description>
<em:creator>Makyen</em:creator>
<em:unpack>true</em:unpack>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0a1</em:minVersion>
<em:maxVersion>43.0a1</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
NOTE: The "<extension-dir>\chrome\icons\default\" directory is different than the one in the response by nmaier. In that answer the "icons" and "default" directories reversed and will be non-functional.
You will probably want an additional file:
<extension-dir>chrome.manifest
The chrome.manifest file is not required. However, not having it may result in a single line being printed to the error/browser console (if you even have that open). If the chrome.manifest file exists, even if zero length, there will be no complaint in the console that the file could not be read.
Install the extension. The easy way to do this is to create a zip file with those three files; then change the file extension to .xpi; then drag and drop it onto a Firefox window running the profile in which you desire it to be installed.
You can expand this to include icons for whatever sub-windows you desire. You will need to determine the ID for each sub-window. The icon file name is just the window ID with the appropriate extension for an icon in the architectures you desire. "main-window" is just the ID for the main Firefox browser window.
Creating an extension to test this took less than 5 minutes. You should find it reasonably easy to accomplish.
This assumes that there is not a custom main-window icon located at (Windows, default install location):
C:\Program Files\Mozilla Firefox\browser\chrome\icons\default
as that directory is for all profiles and is searched first.
This will not work if the extension is either restartless or extractionless.
You can find a brief amount of information about window icons on MDN. nmaier mentions the docs talking about bundles. When talking about Mozilla add-ons, a bundle is your add-on package.
The icon file(s) will be at (Windows):
<profile dir>\extensions\<extension-dir>\chrome\icons\default*
Once the extension is installed, you can change it/them manually without re-installing, if desired.
Based on the discussion in the comments, I created a Firefox Add-on to allow setting the window icons for the profile. It is much expanded upon the 5 minute add-on mentioned in the comments. The addition is entirely in a UI for the options dialog for selecting the icon to use and assigning it to the various different windows Firefox opens. You can get it from Mozilla Add-ons under Change Profile's Window Icons. Unfortunately, it's not possible for that add-on to function as of Firefox 48 which requires add-ons to be signed. To dynamically change the icon requires changing files which must be signed. Thus it's not possible to dynamically change the icon with add-on signing required.
Instead I created a few add-ons which statically change the window icon. You can find them on AMO.
Well, there are some ways that spring to mind, but all with their own issues:
em:unpack
and have the icon(s) in chrome/default/icons
exactly. It is possible that the Firefox in question has an own set of icons bundled in the $appdir/chrome/default/icons
, in particular on *nix
and since they are checked first, they will be used instead of the add-on provided add-ons. So while this approach works for custom add-on windows, it might not for built-in ones. firefox.exe
).WM_SETICON
on Windows.Edit 1:
Actually, thinking more about it, I'd install an add-on with some platform-specific js-ctypes code that would then switch out the icons, e.g. the already mentioned WM_SETICON
on Windows.
Usually you'll need a window handle for the platform APIs, which Firefox refuses to provide to JS. But as a workaround for that:
uuid
.uuid
titled window handle (FindWindow
on Windows). mintrayr uses this scheme for Windows/Gnome(GTK/GDK), also not in js-ctypes.HICON
on windows). I once had a patch somewhere on bugzilla that enabled loading of arbitrary images as window icons FWIW, but let it slide. Should be still somewhere and could give pointers. WM_SETICON
for small/big icon on Windows.Edit 2
Turns out nsIBaseWindow
exposes a nativeHandle
these days, as I learned from your other question. so the window-title–hack isn't needed any longer. However, nativeHandle
might be an 64-bit pointer, which isn't really supported in JS land without some trickery... Better not parseInt
it... Also js numbers are floats.
ctypes.voidptr_t(ctypes.UInt64(nativeHandle))
should work, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With