And*_*een 5 command-line firefox google-chrome
如果 Google Chrome 和 Firefox 都在运行,有没有办法将所有浏览器标签从 Firefox 转移到 Google Chrome?我想编写一个 shell 脚本,将所有选项卡从 Firefox 传输到 Ubuntu 上的 Google Chrome。
按照评论中给出的想法(从 FF 配置文件目录中的文件获取链接sessionrestore.js),这里是一个带有嵌入式 Python 的 Bash 脚本,用于打开 Google Chrome 中的当前选项卡:
google-chrome $(cat ~/.mozilla/firefox/*.default/sessionstore.js | python -c """
import sys, json
jsobj = json.loads(sys.stdin.read())
for tab in jsobj['windows'][0]['tabs']:
print tab['entries'][0]['url'],
""")
Run Code Online (Sandbox Code Playgroud)
请注意,虽然该脚本工作正常,但它没有验证任何内容。但更强大的版本会检查 file 是否存在sessionrestore.js,验证加载 JSON 文件及其内容的结果,等等。
| 归档时间: |
|
| 查看次数: |
1633 次 |
| 最近记录: |