rofibangs: add raw parameter
This commit is contained in:
parent
308f3a6ece
commit
38d24bdb33
16
rofibangs.py
16
rofibangs.py
|
@ -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": [ {
|
{
|
||||||
|
"bangs": [
|
||||||
|
{
|
||||||
"handle": "w",
|
"handle": "w",
|
||||||
"name": "Wikipedia",
|
"name": "Wikipedia",
|
||||||
"url": "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go"
|
"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)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue