Skip to content

Instantly share code, notes, and snippets.

@mmpx12
Created February 8, 2021 16:03
Show Gist options
  • Save mmpx12/f7743a2d8f3be2a613e3393055730f11 to your computer and use it in GitHub Desktop.
Save mmpx12/f7743a2d8f3be2a613e3393055730f11 to your computer and use it in GitHub Desktop.
list firefox open tabs
#!/usr/bin/bash
export opentabs=$(find /home/$USER/.mozilla/firefox/*.default-release//sessionstore-backups/recovery.jsonlz4);
a=0
while read line title; do
a=$((++a))
echo -e "\e[0;1;38;5;196m╭─[\e[0;38;5;40m$a\e[0;1;38;5;160m]\e[0;93m→\e[0;38;5;38m $line\n\e[0;1;38;5;196m╰─▪ \e[0;38;5;155m$title"
done < <(python3 <<< $'import os, json, lz4.block
f = open(os.environ["opentabs"], "rb")
magic = f.read(8)
jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
f.close()
for win in jdata["windows"]:
for tab in win["tabs"]:
i = int(tab["index"]) - 1
urls = tab["entries"][i]["url"]
titles = tab["entries"][i]["title"]
print(urls, titles)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment