Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant find proper location to place config.js and config-prefs.js on Linux #8

Closed
tortious opened this issue Feb 26, 2019 · 46 comments
Closed

Comments

@tortious
Copy link

I am not sure what location to put these files in on Manjaro Linux (KDE Plasma).

Everything seems to be located at /home/myusername/.mozilla/firefox/myprofile/

Your instructions state to place the config.js and config-prefs.js in the firefox installation folder (with the latter being placed within \defaults\prefs). However, aside from the path mentioned above, I am having trouble finding anything else that looks like it could be my firefox installation folder.

I also tried looking for channel-prefs.js to get a frame of reference as to my installation folder location, but could not find that either.

Please help. Thank you!

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Feb 26, 2019

fx-folder.zip files are packed with paths used by Firefox for Windows.
Linux users must extract the two files individually to the paths below.

  • /usr/lib/firefox/config.js
  • /usr/lib/firefox/browser/defaults/preferences/config-prefs.js

On Linux, extractting folders structure from fx-folder.zip may not work. Windows uses \Mozilla Firefox\defaults\pref\config-prefs.js, while some Linux packages may use /firefox/browser/defaults/preferences/config-prefs.js.

Of course, it's possible that you have installed Firefox in a different location, but /usr/lib/firefox/ is usually the default.

If you use use Firefox snap, main folder is /etc/firefox/, so:

  • /etc/firefox/config.js
  • /etc/firefox/defaults/pref/config-prefs.js

@mozo78
Copy link

mozo78 commented Jul 30, 2020

It's working great on Linux, thank you :)
https://i.imgur.com/vhogQMU.png

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Hello! Could you please explain this more detailed?
I think 'config.js' belongs into '/opt/waterfox-g3/browser/defaults/preferences/' now. But where does 'config-prefs.js' go?
When I try putting it into same directory as config.js I get 'Error reading configuration file.'

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Dec 28, 2020

I don't use Linux, but I think I need to edit my comment above.

Here on Windows, config.js must be placed along with Firefox executable, and config-prefs.js must be placed a little deeper, into \defaults\prefs. On Linux, it seems that the folder is named preferences instead of prefs, and defaults folder is inside browser.

The thing is that in my previous comment I said that config.js must be placed in preferences folder, but it should be config-prefs.js.

So I think it's like:
/usr/lib/firefox/config.js
and
/usr/lib/firefox/browser/defaults/preferences/config-prefs.js

Try this and tell me if it works, so I can edit my previous comment.

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Yes, this seems to work (besides the UI looking bugged in detail, the paths seem to be working).
(The rebuild button doesn't exist, despite having the script in '/home/ladmin/.waterfox/0mu06md0.default/chrome/rebuild_userChrome.js', but the staus bar is being shown)
So adapted to my setup (with Waterfox and installation in /opt) it's looking like this:

/opt/waterfox-g3/browser/defaults/preferences/config-prefs.js
/opt/waterfox-g3/config.js

Thank you! 👍

Btw: During this I found that the 'old' path still exists, which is adding some confusion:
'/opt/waterfox-g3/defaults/pref/channel-prefs.js'
Can I assume this is outdated and should be deleted, from my interpretation of

Formerly:
defaults/pref
(Still working in Firefox 60.0a1)
Presently:
browser/defaults/preferences
?

@xiaoxiaoflood
Copy link
Owner

Thank you, comment updated.

About unpolished UI, unfortunately it's expected because I don't test on Linux and there are minor CSS differences here and there. Maybe someone could write fixes and submit them for me.

@Lalarian
Copy link

Where would I have to search for the reason the button is not there?

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Dec 28, 2020

rebuild_userChrome.js

It must be rebuild_userChrome.uc.js.

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Oh, sorry - it actually is. That was just a type of mine.
I just remembered that I could not find a way for clearing the startup cache in the beginning.
Because there's neither a button for doing so in about:support nor is there a directory named 'startupCache' in my profile folder..

Maybe this is the reason.

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Dec 28, 2020

If status-bar.uc.js is working for you, the issue here is not about startupCache.

Keep in mind that I use Firefox Developer Edition, currently in version 85. Things may or may not work on other versions (apparently you're using Waterfox based on Fx 78), I don't officially support any version other than current DevEv.

Rebuild's button should be automatically placed next to urlbar. There's also the item in hamburger menu:

And it's possible to replace the icon by item in Tools menu:

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Wow, both items don't exist in my browser. Neither The Manager's entry in the Tools menu, nor 'UserScripts' in the hamburger menu.
About menu says 'based on Gecko 78.6.0'. So probably my browser is too old.

I just naively I entered the rebuild-button-script into Tampermonkey and executed it through the context menu. Result was:
ERROR: Execution of script 'userChromeJS Manager' failed! UC is not defined
But probably this is just a matter of scope/context, I assume..

@xiaoxiaoflood
Copy link
Owner

userChromeJS scripts (.uc.js) are totally different than normal UserScripts (.user.js).

Well, rebuild is not running for you. The reason, unfortunately, only you can debug. Just make sure rebuild_userChrome.uc.js is in chrome folder, in the same location as status-bar.uc.js and any other .uc.js. And you need to restart Firefox to apply.

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

OK, then thank you very much! 👍
Finally my browser is working again - I can even move AddOn induced items into the new status bar, that's what I needed. Probably the rest is going to work once Waterfox (or even Firefox stable) reaches the required version.
P:
I will still try a bit.. where could I see debugging information about userchrome scripts? I couldn't find anything in regards to userchrome in the F12 tools, yet.

@xiaoxiaoflood
Copy link
Owner

I just tried on Fx 78 and it's working. I don't know if Waterfox has something exclusive that may break it, but I don't think so. If status-bar is running, userChromeJS is running. So just save rebuild in the same folder you put satus-bar.uc.js and restart Firefox (Waterfox).

@xiaoxiaoflood
Copy link
Owner

where could I see debugging information about userchrome scripts?

Open about:config, set devtools.chrome.enabled to true. Open Browser Console (at least on Widows you can do it with Ctrl+Shift+J), paste _uc.scripts and press Enter, then you'll see all installed userChromeJS scripts.

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Good to hear that it should be working. Gonna try to find some debugging info now!
Hm, the script isn't even found:

_uc.scripts
Object { "rebuild_userChrome.uc.js": {…}, "status-bar.uc.js": {…} }

And nothing else..

Bildschirmfoto_2020-12-28_07-23-46

@Lalarian
Copy link

I found an error that comes with the rebuild script:
07:33:52.671 CustomizableUI: Custom widget with id userChromebtnMenu does not return a valid node CustomizableUI.jsm:1692

@xiaoxiaoflood
Copy link
Owner

Well, rebuild is on the list. The next step would be searching for errors caused by "userChrome" in Browser Console just after launching Firefox...

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

I found an error and a warning that come with the rebuild script:

07:33:52.671 CustomizableUI: Custom widget with id userChromebtnMenu does not return a valid node CustomizableUI.jsm:1692

07:33:52.671 NotFoundError: Node.insertBefore: Child to insert before is not a child of this node rebuild_userChrome.uc.js:326:68
    onBuild file:///home/ladmin/.waterfox/0mu06md0.default/chrome/rebuild_userChrome.uc.js?1609117711000:326
    aEventName resource:///modules/CustomizableUI.jsm:2867
    buildWidget resource:///modules/CustomizableUI.jsm:1689
    getWidgetNode resource:///modules/CustomizableUI.jsm:1164
    buildArea resource:///modules/CustomizableUI.jsm:974
    registerToolbarNode resource:///modules/CustomizableUI.jsm:888
    registerToolbarNode resource:///modules/CustomizableUI.jsm:3604
    onDOMContentLoaded chrome://browser/content/browser.js:1814
    onDOMContentLoaded self-hosted:844
    (Async: EventListener.handleEvent)
    <anonym> chrome://browser/content/browser.xhtml:131

Sorry for posting twice - I posted without reloading first :)

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Dec 28, 2020

This must be Waterfox specific, because there are no errors in Firefox. Sorry, but I don't plan to support other versions or browsers.

If you run this on Browser Console, it returns true or false?
[...document.getElementById('menu_ToolsPopup').children].includes(document.getElementById('menu_preferences'))

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

Somehow the console window got messed up :(
The command input box moved from the bottom to the left and I cannot see any response to the commands I entered anymore.
Bildschirmfoto_2020-12-28_07-53-09

This happened when I clicked the cogwheel at the upper right for checking what's in there. Without even choosing an option.

@Lalarian
Copy link

Hm. no idea, but somehow I just fixed it after 10 minutes of fiddling :)

Your requests results in false :(


07:57:01.024 [...document.getElementById('menu_ToolsPopup').children].includes(document.getElementById('menu_preferences'))
07:57:01.067 false

@xiaoxiaoflood
Copy link
Owner

xiaoxiaoflood commented Dec 28, 2020

I think I got it. It's not Waterfox related, but Linux related. On Linux, Preferences is under Edit menu, not under Tools (and on Windows it's "Options" instead of "Preferences").

I'll try something...

@Lalarian
Copy link

Oh, it would be super if that helped :)
I could exactly note this issue, as I also have the German translation installed :)

@xiaoxiaoflood
Copy link
Owner

In rebuild code, try replacing
aDocument.getElementById('menu_ToolsPopup')
by
aDocument.getElementById('menu_preferences').parentElement

Save then restart Firefox. It should work.

I'll soon upload the updated script with something like this.

@Lalarian
Copy link

Lalarian commented Dec 28, 2020

It's working! 👍

I didn't expect it to go so fast, because we got so many unknonws here.. like Linux, Older Version and Waterfox.
Btw: In the meantime I found the startupCache on Linux to be located in the user's .cache directory:
'~/.cache/<whatever>fox/<userprofile>'

@xiaoxiaoflood
Copy link
Owner

Script updated, thank you.

@guillaumedavidphd
Copy link

Hello there!
I'm having a hard time finding the correct location. I'm running Ubuntu 21.10, which uses the Snap version of Firefox by default. Is it at all possible to use firefox-scripts with the Snap version?
Any help is appreciated!

@mozo78
Copy link

mozo78 commented Feb 3, 2022

Any reason using snap FF? Uninstall the snap version and install the regular version:
sudo apt install firefox

@guillaumedavidphd
Copy link

@mozo78 No reason in particular, it's just the default version that ships with Ubuntu these days. I'm wondering if it's possible to use firefox-scripts with it. I do know that I can choose to uninstall the default snap version and install the apt version as an alternative. But it's not really what I'm asking here.

@mozo78
Copy link

mozo78 commented Feb 3, 2022

I see :) Let's hope xiaoxiaoflood will know.

@xiaoxiaoflood
Copy link
Owner

I don't know, I don't use Linux (yet, maybe).

@mozo78
Copy link

mozo78 commented Feb 3, 2022

Great mistake :)

@BICH0
Copy link

BICH0 commented Apr 13, 2022

Hi, i have followed all the steps in the installation and i cant manage to make it work, i tried changing the ownership and permissions of the files with no luck, these are the paths that i am using:
/usr/lib/firefox/config.js
/usr/lib/firefox/browser/defaults/preferences/config-prefs.js (i also tried inside /usr/lib/defaults/pref/)
Im running firefox-99.0.1-1
Edit: i found a workaround for this issue, at least in my case the chrome.manifest needed to be inside ~/.mozilla/firefox/randomnumber.default-release/chrome/utils/
So the references inside the manifest needed to be changed to make sense:
content userchromejs ../
resource userchromejs ../..
So everything solved ;)

@AdamPS
Copy link

AdamPS commented Sep 16, 2022

Any reason using snap FF? Uninstall the snap version and install the regular version: sudo apt install firefox

With Ubuntu 22.04 there is no longer a firefox apt package. So far I can't seem to get it to work with snap. Here's what I've found so far:

@Massimo-B
Copy link

How can I get this installed on FF 102.3.0 (ESR) on Linux? I can't find any config.js or config-prefs.js on my Firefox installation.

@EzPzDev
Copy link

EzPzDev commented Oct 16, 2022

Hi, i have followed all the steps in the installation and i cant manage to make it work, i tried changing the ownership and permissions of the files with no luck, these are the paths that i am using: /usr/lib/firefox/config.js /usr/lib/firefox/browser/defaults/preferences/config-prefs.js (i also tried inside /usr/lib/defaults/pref/) Im running firefox-99.0.1-1 Edit: i found a workaround for this issue, at least in my case the chrome.manifest needed to be inside ~/.mozilla/firefox/randomnumber.default-release/chrome/utils/ So the references inside the manifest needed to be changed to make sense: content userchromejs ../ resource userchromejs ../.. So everything solved ;)

This also worked for me on OpenSUSE Tumbleweed with FF104. The path for fx-folder.zip was:
/usr/lib64/firefox/config.js
/usr/lib64/firefox/browser/defaults/preferences/config-prefs.js
There's also a /usr/lib64/firefox/defaults/pref/ folder but I didn't use it.

The trick, thanks to @BICH0, was to move chrome.manifest into a new (at least for me) folder called utils in ~/.mozilla/firefox/$firefox.profile/chrome/ then updating the references in the manifest. Content should point to your chrome folder and resource should point to your profile folder.

@benyaminl
Copy link

My question, when we update using package manager, @EzPzDev, does we need to backup all first so the data doesn't get lost or let the package manager done it, and the addons/JS still there? Thanks

@EzPzDev
Copy link

EzPzDev commented Oct 29, 2022

I'm probably not the best person to ask, and I recommend having at least a backup folder (preferably not on your main storage) to keep various files you've added or changed on your system.

That being said; as long as Firefox doesn't change it's file structure or anything everything should still be there when you update using your package manager. Your chrome folder with your addons/JS should definitely persist between Firefox updates.

@mozo78
Copy link

mozo78 commented Oct 29, 2022

You don't need to backup anything.

@tomchiverton
Copy link

tomchiverton commented Dec 15, 2022

Any reason using snap FF? Uninstall the snap version and install the regular version: sudo apt install firefox

With Ubuntu 22.04 there is no longer a firefox apt package. So far I can't seem to get it to work with snap. Here's what I've found so far:

* [Issue on snapcraft](https://forum.snapcraft.io/t/firefox-snap-no-longer-reads-usr-lib-firefox-for-customization/29713)

* [Mozilla bug report](https://bugzilla.mozilla.org/show_bug.cgi?id=1785278)

This is now fixed ( #64 (comment) ) so drop files in

  • copy config.js to /etc/firefox/config.js
    
  • copy config-prefs.js to /etc/firefox/defaults/pref/config-prefs.js
    

Although this doesn't seem to be working for me at present as Tab Mix Plus doesn't want to enable

Edit : tab mix plus runs fine on Snap and non Snap

@KarlG1965
Copy link

Hi, can anyone advise me how to do this when firefox is installed in /opt/firefox?

I don't use apt, snap or flatpak - I just download the zip file from mozilla's website and extract it to the /opt folder-

@tomchiverton
Copy link

The above should be sufficient. What happens when you try?

@KarlG1965
Copy link

KarlG1965 commented Feb 19, 2023

I don't have all the folders mentioned - for example, I don't have an /etc/firefox directory so I can't try the above

@tomchiverton
Copy link

tomchiverton commented Feb 19, 2023 via email

@KarlG1965
Copy link

Apologies, I didn't notice that this issue was closed. I'll create a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests