Firefox – How to edit search engines in Firefox Quantum

firefox

I use several search engines in Firefox Quantum, each with 1 – 3 letter shortcuts (w for Wikipedia, m for Google Maps, etc.), and I need to modify the URL of one of the search engines.

I remember there was some XML file in past versions, but this seems to have changed over time:

  • Where are these now saved and how do I edit them?
  • Can I create a custom one?

Best Answer

In Ubuntu 16, FireFox 58, the configuration file is compressed into the .mozlz4 format:

~/.mozilla/firefox/<name>.default/search.json.mozlz4

You can decompress/compress this file via the python lz4 library:

  • Decompress:
    import lz4.block as lb
    
    infile = '/path/to/infile'
    outfile = '/path/to/outfile'
    
    inf = open(infile, 'rb')
    inf.read(8)
    data = lb.decompress(inf.read())
    outf = open(outfile, 'wb')
    outf.write(data)
    
  • Compress:
    import lz4.block as lb
    
    infile = '/path/to/infile'
    outfile = '/path/to/outfile'
    
    inf = open(infile, 'rb')
    data = lb.compress(inf.read())
    data = b'mozLz40\0' + data
    outf = open(outfile, 'wb')
    outf.write(data)
    
Related Question