Created
December 3, 2020 19:40
-
-
Save eirikb/6e6eb0e21d32f6f914b1016959e94f35 to your computer and use it in GitHub Desktop.
Sort Firefox container tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const os = require('os'); | |
const path = `${os.homedir()}/.mozilla/firefox`; | |
for (const dir of fs.readdirSync(path)) { | |
const file = [path, dir, 'containers.json'].join('/'); | |
if (fs.existsSync(file)) { | |
console.log('Fixing', file); | |
const containers = require(file); | |
containers.identities.sort((a, b) => (a.name || '').localeCompare(b.name)); | |
fs.writeFileSync(file, JSON.stringify(containers)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment