I've built the Chromium browser on my Windows from its source code (Github) by following this documentation. After doing this successfully, I've a chrome.exe file which is able to launch the browser (see screenshot).
The next thing I want to implement is to change the logo and name of Chromium (say, MyBrowser) everywhere on the browser. I'm stuck at this step. Is there any way to achieve this by modifying the code or replacing the icon?
You will have to make lots of changes. Before replacing these files, please make sure the files that you are replacing with matches the resolution and format too.
If you want to change the logo of Chromium then replace these files with yours
src/chrome/app/theme/chromium/product_logo_22_mono.png
src/chrome/app/theme/chromium/product_logo_24.png
src/chrome/app/theme/chromium/product_logo_48.png
src/chrome/app/theme/chromium/product_logo_64.png
src/chrome/app/theme/chromium/product_logo_128.png
src/chrome/app/theme/chromium/product_logo_256.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_16.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_32.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_name_22.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_16.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_32.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_name_22.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_name_48.png
src/chrome/app/theme/chromium/win/tiles/Logo.png
src/chrome/app/theme/chromium/win/tiles/SmallLogo.png
Then replace this icon file:
For Windows:
src/chrome/app/theme/chromium/win/chromium.ico
For macOS:
src/chrome/app/theme/chromium/mac/app.icns
To change the name of the browser and messages displayed in Chromium, open and modify these files
src/chrome/app/theme/chromium/BRANDING
src/chrome/app/generated_resources.grd
src/chrome/app/chromium_strings.grd
You should replace Chromium or Chrome references from the above files with your brand
Related
I want to create a new profile with an addon preinstalled.
What works:
run firefox a first time.
add the addon.xpi to profile/extensions/addon.xpi.
edit profile profile/extensions.ini and add Extension0=/full/path/to/extension.xpi.
start firefox again.
What i need:
add the addon to profile/extensions/addon.xpi.
edit extensions.ini or something similiar.
use only relative paths, if possible (seems not to be implemented for extensions.ini)
Finally i want to create a zip file with some firefox preferences/addons, which can be unziped into a profilefolder to create a fresh profile with some preinstalled stuff. For this, it would be important, that everything works with relative paths. If it is definitely not possible, i can add some script to it. But i would prefer some "just unzip" solution.
I think it may be a bit harder, because mozilla wanted to prevent other software from adding toolbars and similiar to firefox by making external addon installation harder. What i already found is the key extensions.autoDisableScopes=0.
What you can do is open firefox with command line options. And pass the file path to your xpi file, so you don't have to mess with all this internals you are over there.
So do this:
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "C:\my.xpi"
and on launch it will open a tab and prompt to install your addon.
In the prefs.js:
pref("extensions.autoDisableScopes", 14); // 0x1 not set
See https://developer.mozilla.org/en-US/Add-ons/Installing_extensions#Disabling_install_locations
Then put the addons into extensions/myaddonid.xpi, making sure the filename is the id given in the install.rdf file inside the addon.xpi (zip-)file as <em:id>addon_id</em:id> tag.
On the next start the addons will be silently installed. Some addons needed one restart to work, at least the toolbar buttons were not added on the first start.
Not sure, if this will still work, when firefox decides to allow only addons signed by addons.mozilla.org. On the other hand, they will allow self-hosting addons, as soon as they are signed by AMO, so preinstalling addons downloaded from there will have a good chance.
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:
I created shortcut of firefox.exe and moved it to my documents
right click on this shortcut and then changed icon
but in firefox the taskbar shows normal firefox icon and so does the top left icon (see attached image plz)
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/
As of Firefox 57, this is not possible from an extension.
WebExtensions do not permit the window icon to be changed from an extension.
Prior to Firefox 57 (or non-release versions w/ legacy add-ons)
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:
<extension-dir>instal.rdf
<extension-dir>\chrome\icons\default\main-window.ico
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>window-icon-change#nowhere.foo</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.
Add-ons created to solve this
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:
Using Window Icons provided by an add-on you install into the profile (the docs talk about bundles, but add-on can also use this technique). The add-on must be 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.
Copy and patch Firefox itself, aka. the sledgehammer approach. Different for each platform (e.g. under Windows you'd have to swap out the icon resource of the firefox.exe).
Create a tool that will switch out the icons of a running window. There is no code to do so in Firefox that would be accessible from javascript, so you need to go binary and platform-specific, e.g. 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:
Store the window title.
Set the window title to a new uuid.
Call a platform API to find the new uuid titled window handle (FindWindow on Windows). mintrayr uses this scheme for Windows/Gnome(GTK/GDK), also not in js-ctypes.
Restore the window title.
Load/transform the icon file to something the platform supports (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.
Switch the icon using the obtained handle. E.g. Sending two 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.
On Mac OS X, this Firefox plugin will do just that: https://addons.mozilla.org/en-US/firefox/addon/fosx-label/. Also on GitHub: https://github.com/jf/fosx-label. Thanks to Noitidart for pointing out this very useful plugin.
Tested on Yosemite 10.10.5 and it works perfectly!
I am following the instructions here to make my development environment for firefox:
https://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/
and everything is working great.
On the page as you can see there is one instruction:
Point your Firefox extensions directory to your extension
Instead of constantly preparing and
reinstalling your extension, there’s a
simple way to add a pointer from your
Firefox extensions directory to your
code location. To do this, you must
first find your profile directory: ...
And that too is working great!
My question is:
When I make changes to the JS file in the dev directory, do I have to keep restarting FF for the changes to take effect? Because when I create an extension in Chrome there is a simple link that says "reload" and clicking that reloads the extension without me needing to restart the browser... does any such functionality exist for FF?
Thanks!
R
Extension Developer extension has an option to reload chrome. Doing that should reload your extension without restarting Firefox.
It really depends on the JavaScript files. XPCOM components and JavaScript modules load only once, there you unavoidably need to restart when you change them. JavaScript files loaded via <script> tags are only valid for the window that loaded them - opening a new window will do to load a fresh copy of the script. All that will only work correctly if -purgecaches command line option is specified as other people noted already.
I downloaded this Firefox sample extension from mozilla.org, I modified the file install.rdf and changed maxVersion value to 3.6.10 (also tried 3.6.*, 100 and *) and I added a new string with name "hello world" and the value is the path where the folder of the sample extension is to HKCU (also tried HKLM)/Software/Mozilla/Firefox/Extensions/ into the registry.
I start Firefox, go to Tools > Addons, and it says it needs to restart, I restart and go there again and the plugin appears but says "Not compatible with Firefox 3.6.10", and every button appears disabled. Also removing the registry key and folder doesn't uninstall it.
Is there something else I have to change to use the hello world sample in Firefox 3.6.10?
Update 2018
This sample extension was created in 2000s and Firefox switched to a radically different extension system called "Web Extensions" in 2017. The old extensions will not work in the current versions of Firefox and have to be rewritten completely.
The easiest way to start developing an extension is putting a "pointer" file in the extensions folder in the profile directory. I wouldn't touch the registry method until the deployment moment.
Thanks for reminding me to update the example extension. Updated it now.
Basically, the best way to use an extension is to package the addon in .xpi format. Then you just have to open this addon with Firefox. Note:To make an .xpi , take all the contents of helloworld like content,locale,skin,install.rdf,chrome.manifest etc and try to zip it but change the extension to .xpi instead of .zip. Otherwise u can just rename ur helloworld folder to helloworld#xyz.com and then copy this folder into C:\Users\"OS user name"\AppData\Roaming\Mozilla\Firefox\Profiles\h31hcfq9.default\extensions and then restart ur browser. Also, it would be best to learn about addon development with this Basic tutorial on addon development
The procedure to create sample firefox extension can be found on this link. This tutorial explains how to create a Firefox extension to find all links in the current web page, highlight those which have a target attribute and alert you how many links it found.
On a Website for our internal use i show links to local files and folders. the links are like this:
href="file://C:/example/"
href="file://C:/example/test.odt"
The Problem is now that the link to the directory does open in firefox itself with a useless directory listing. Useless because you can just see the files or open them but not copy, insert, delete...
The link to the file work normal and the file is opend by OpenOffice.
By changing the configuration of firefox and setting the following key to false I can open the directory in with explorer.exe but for the file I have to choose the right application.
network.protocol-handler.expose.file
Does someone know a way to get both to work like i want? Means that the Directory is shown by explorer.exe and all files are opened by the right application.
This can be by configuring Firefox or windows, changing the links, or even by writing a small program which opens all the file protocol correctly and will be used as protocol handler for the file protocol in firefox.
Thanks
Raffael
I did the above with small changes in Firefox 14.0.1, which works for me:
Create new boolean value network.protocol-handler.expose.file and set it to false
Create new boolean value network.protocol-handler.external.file and set it to true
Click on a link to a local folder.
In the following prompt, link to the explorer.exe in: C:\Windows\explorer.exe
Files are now open with the default application, folders are open with the Windows Explorer!
I know this is not quite what you want, but you might take a look at the "launchy" addon for firefox:
https://addons.mozilla.org/en-US/firefox/addon/81/
Using this addon you can right click on a file link, go to "launchy" sub-menu, and tell it to open in explorer. This will browse directly to the folder as you want.
I want the same feature you want, however this "works" for now. I have asked the author of launchy to allow it to override the left-click behavior for certain protocols (so it would launch explorer with one click), but I don't have a response yet.
edit: Years later, I will post the solution I started using instead of Launchy:
https://addons.mozilla.org/en-us/firefox/addon/local-filesystem-links/
https://github.com/feinstaub/firefox_addon_local_filesystem_links
This scans for file:// links and makes them clickable. It does inject some HTML which can mess with formatting if you aren't careful, but it does the job.
In about:config You need to add a boolean value with the name network.protocol-handler.expose.file and set it to false and also create a string value with the name capability.policy.default.checkloaduri.enabled and set it to allAccess.
Now you will be able to choose C:\Windows\explorer.exe to open file links.
Tested in FF 19.0.2 in Windows 7.
Try this:
Create new boolean value with the name
network.protocol-handler.expose.file and set it to false
Create new boolean value with the name
network.protocol-handler.external.file and set it to true
Open link to a local directory and on the now appearing box, register the "file"-protocol permanently with the "file"-programm (1st entry).
There should now open the windows explorer.
You can deassociate the type "file" in the Firefox-settings (applications-tab).
After that, a link to a document (i.e. file:///x:\dir\file.doc) worked automatically for me (FF8.0).
Or You can use the Plugin "Local Filesystem Links" (DE version of the page) now.
--
edit:
Link for EN version: https://addons.mozilla.org/en-US/firefox/addon/local-filesystem-links/?src=search