1
0
Fork 0

rofibangs: add raw parameter

This commit is contained in:
dece 2022-08-28 15:46:14 +02:00
parent 308f3a6ece
commit 38d24bdb33

View file

@ -7,11 +7,18 @@ want a Wikipedia article for "burger", or at least a much needed
disambiguation disambiguation
Config file example: Config file example:
{ "bangs": [ { {
"handle": "w", "bangs": [
"name": "Wikipedia", {
"url": "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go" "handle": "w",
} ] } "name": "Wikipedia",
"url": "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go"
}
]
}
Optionally, a bang object can contain a "raw" key with a boolean value: if
true, arguments are passed without being URL-encoded.
By default this scripts attempts to load your config file from By default this scripts attempts to load your config file from
`~/.config/rofibangs.json`, but you can specify the ROFIBANGS_CONFIG_PATH `~/.config/rofibangs.json`, but you can specify the ROFIBANGS_CONFIG_PATH
@ -66,7 +73,10 @@ def open_bang(config, handle, query):
else: else:
print("Unknown handle.") print("Unknown handle.")
return return
url = bang["url"].format(urllib.parse.quote(query.strip())) query = query.strip()
if not bang.get("raw", False):
query = urllib.parse.quote(query)
url = bang["url"].format(query)
webbrowser.open_new_tab(url) webbrowser.open_new_tab(url)