1
0
Fork 0

Add fh userscript

This commit is contained in:
Jeremy Kaplan 2019-08-07 19:24:21 -07:00
commit 4ba21cd72b
2 changed files with 18 additions and 1 deletions

View file

@ -11,7 +11,9 @@ config.load_autoconfig()
# Aliases for commands. The keys of the given dictionary are the
# aliases, while the values are the commands they map to.
# Type: Dict
c.aliases.update({"rmqs": "spawn --userscript clean-url"})
c.aliases.update(
{"rmqs": "spawn --userscript clean-url", "fh": "spawn --userscript fh-add"}
)
# How often (in milliseconds) to auto-save config/cookies/etc.
# Type: Int

15
qutebrowser/userscripts/fh-add Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import os
from urllib.parse import urlencode
url = os.environ["QUTE_URL"]
fifo = os.environ["QUTE_FIFO"]
title = os.environ["QUTE_TITLE"]
query = {"title": title, "url": url}
share_link = "https://metagram.net/firehose/share?{}".format(urlencode(query))
with open(fifo, "w") as f:
f.write(":open {}".format(share_link))