Skip to content

Instantly share code, notes, and snippets.

@dmitriykovalev
Last active January 5, 2024 19:14
Show Gist options
  • Select an option

  • Save dmitriykovalev/3f155fbb48dc3e403d0e591d75f8b72b to your computer and use it in GitHub Desktop.

Select an option

Save dmitriykovalev/3f155fbb48dc3e403d0e591d75f8b72b to your computer and use it in GitHub Desktop.
Save all chrome tabs to json file.
#!/bin/bash
osascript -l JavaScript > $(date '+%Y.%m.%d-%H.%M.%S')-chrome-tabs.json <<EOF
var app = Application('Google Chrome');
let result = app.windows().map((w) => {
return {
'name': w.name(),
'tabs': w.tabs().map((t) => {
return {'title': t.title(), 'url': t.url()};
}),
};
});
JSON.stringify(result, null, 2);
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment