Skip to content

Instantly share code, notes, and snippets.

@eirikb
Created December 3, 2020 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eirikb/6e6eb0e21d32f6f914b1016959e94f35 to your computer and use it in GitHub Desktop.
Save eirikb/6e6eb0e21d32f6f914b1016959e94f35 to your computer and use it in GitHub Desktop.
Sort Firefox container tabs
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