Skip to content

Instantly share code, notes, and snippets.

@moll
Last active November 23, 2017 22:09
Show Gist options
  • Save moll/c5ce1412f07b9a3c71aded00646e4444 to your computer and use it in GitHub Desktop.
Save moll/c5ce1412f07b9a3c71aded00646e4444 to your computer and use it in GitHub Desktop.
Extract Firefox Tab Groups from `sessionstore.js`
(
.windows[0].extData."tabview-group" |
fromjson |
map({key: .id | tostring, value: .}) |
from_entries
) as $groups |
.windows[0].tabs |
map(select(.extData."tabview-tab")) |
map({
key: $groups[.extData."tabview-tab" | fromjson | .groupID | tostring].title,
value: .entries[-1] | {url: .url, title: .title}
}) |
group_by(.key) |
map({key: .[0].key, value: map(.value)}) | from_entries
@moll
Copy link
Author

moll commented Nov 23, 2017

And later create a readable Markdown document with:

jq -r 'keys[]' tab-groups.json | while read -r group; do
  echo
  echo
  echo "$group"
  echo $(echo -n "$group" | tr -c . -)
  jq -r ".\"$group\"[] | \"- [\(.title)](\(.url))\"" tab-groups.json
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment