1
0
Fork 0

Add qutebrowser userscripts

This commit is contained in:
Jeremy Kaplan 2018-08-10 22:47:58 -07:00 committed by Jeremy Kaplan
commit ed3b45302d
3 changed files with 16 additions and 1 deletions

View file

@ -5,6 +5,7 @@
~/.config/polybar: polybar/
~/.config/qutebrowser: qutebrowser/
~/.config/termite: termite/
~/.local/share/qutebrowser/userscripts: qutebrowser/userscripts
~/.mbsyncrc: isync/.mbsyncrc
~/.mutt: mutt/
~/.xinitrc: X/.xinitrc

View file

@ -11,7 +11,7 @@ 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 = {'w': 'session-save', 'q': 'quit', 'wq': 'quit --save'}
c.aliases.update({"rmqs": "spawn --userscript clean-url"})
# How often (in milliseconds) to auto-save config/cookies/etc.
# Type: Int

View file

@ -0,0 +1,14 @@
#!/usr/bin/env python3
import os
from urllib.parse import urlparse, urlunparse
mode = os.environ["QUTE_MODE"]
url = os.environ["QUTE_URL"]
fifo = os.environ["QUTE_FIFO"]
(scheme, netloc, path, params, query, fragment) = urlparse(url)
clean = urlunparse((scheme, netloc, path, params, "", fragment))
with open(fifo, "w") as f:
f.write(":open {}".format(clean))