Add qutebrowser userscripts
This commit is contained in:
parent
93630811dd
commit
ed3b45302d
3 changed files with 16 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
14
qutebrowser/userscripts/clean-url
Executable file
14
qutebrowser/userscripts/clean-url
Executable 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue