User.js: include a method for users to easily include custom entries / override this user.js

Created on 16 Nov 2015  路  5Comments  路  Source: pyllyukko/user.js

didnt know how to word title properly.

info here https://github.com/pyllyukko/user.js/pull/54
one may want to use this user.js but have a few things in it which they want configured differently. appending to the end of the file overrides previous entries but apparently that breaks git stuff

i just came across this http://kb.mozillazine.org/Locking_preferences
havent tried it yet but it if a file of lockprefs can override user.js then this might be a solution? people would just need to add their preferences as lockprefs in the lockprefs file. but i just realised, if it reads these files in a particular order, it may be possible to just put regular user_pref's in one of these files

will test

enhancement

Most helpful comment

@pyllyukko ive found a solution, so you can close this if you want. maybe add some information about it to the readme for curious users?

this article has all the information: http://kb.mozillazine.org/Locking_preferences

one has to create a local-settings.js file in their %APP%\defaults\pref folder. %APP% being the folder where the firefox or thunderbird executable resides (on windows). mine is D:\Program Files (x86)\Mozilla Thunderbird\defaults\pref\. the contents should be:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

and then a mozilla.cfg file needs to be created in the same directory as the .exe e.g. D:\Program Files (x86)\Mozilla Thunderbird\ where entries can be added to override user.js. they can either be normal preferences (which override), or they can be locked preferences which no addon or anything can change once the application starts. e.g:

lockPref("gfx.downloadable_fonts.enabled",true); // a locked preference which wont change in about:config
pref("permissions.default.image",1); // a normal preference which can be changed in about:config

All 5 comments

One possible solution is to add override.js and myuser.js to .gitignore. Then one can simply git pull && cat user.js override.js > myuser.js, no?

@mengele-chan it would be a decent solution if it is confirmed that entries at the end of the file actually override entries above.

@nodiscc
See https://github.com/pyllyukko/user.js/pull/54#issuecomment-147024370:

ok i just confirmed that when there are multiple entries of the same name, the later ones override the ones before them. so any user differences could just be appended to the bottom and they will override your settings.

and https://github.com/pyllyukko/user.js/issues/75#issue-117064717:

appending to the end of the file overrides previous entries but apparently that breaks git stuff

@pyllyukko ive found a solution, so you can close this if you want. maybe add some information about it to the readme for curious users?

this article has all the information: http://kb.mozillazine.org/Locking_preferences

one has to create a local-settings.js file in their %APP%\defaults\pref folder. %APP% being the folder where the firefox or thunderbird executable resides (on windows). mine is D:\Program Files (x86)\Mozilla Thunderbird\defaults\pref\. the contents should be:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

and then a mozilla.cfg file needs to be created in the same directory as the .exe e.g. D:\Program Files (x86)\Mozilla Thunderbird\ where entries can be added to override user.js. they can either be normal preferences (which override), or they can be locked preferences which no addon or anything can change once the application starts. e.g:

lockPref("gfx.downloadable_fonts.enabled",true); // a locked preference which wont change in about:config
pref("permissions.default.image",1); // a normal preference which can be changed in about:config

Cool, thanks. I added a note to the README.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  7Comments

darnir picture darnir  路  6Comments

gerroon picture gerroon  路  3Comments

Riyyi picture Riyyi  路  3Comments

brakenow picture brakenow  路  5Comments