[qutebrowser] Add search engines, javascript toggle

Toggle Javascript on/off with <leader>js. Reload the configuration file
with <leader>VV. The search engines include reddit, github, wikipedia,
archlinux, aur, gopackages and more.
This commit is contained in:
Marty Oehme 2019-08-06 09:25:57 +02:00
parent 4825466d2a
commit b83a679d1d
3 changed files with 293 additions and 11 deletions

View file

@ -11,17 +11,29 @@ import os
# Uncomment this to still load settings configured via autoconfig.yml
config.load_autoconfig()
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
c.completion.web_history.max_items = 1000
c.hints.uppercase = True
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')
c.content.pdfjs = True
c.content.javascript.enabled = False
js_whitelist = [
"*://*.youtube.com/*",
"*://127.0.0.1/*",
"*://darksky.net/*"
"*://deepl.com/*",
"*://duckduckgo.com/*",
"*://github.com/*",
"*://localhost/*",
"*://news.ycombinator.com/*",
"*://reddit.com/*",
"*://translate.google.com/*",
"file://*",
"chrome://*/*",
"qute://*/*",
]
for page in js_whitelist:
with config.pattern(page) as p:
p.content.javascript.enabled = True
c.editor.command = ["alacritty", "-e", "nvim", "-f", "{file}"]
@ -30,11 +42,13 @@ c.editor.command = ["alacritty", "-e", "nvim", "-f", "{file}"]
# Tab-Bar
# have tab bar on the right, not on the top
c.tabs.background = True
c.tabs.title.format = '{perc}{current_title}'
c.tabs.position = "right"
c.tabs.width = "15%"
# give the browser nice nord theme colors
config.source('nordtheme.py')
config.source('themes/nordtheme.py')
# Status bar
# should be visible to prevent 'jumping' bug, see https://github.com/qutebrowser/qutebrowser/issues/2236
@ -91,3 +105,23 @@ config.bind(leader + 'ss', 'set content.user_stylesheets ""')
config.bind(leader + 'sd', 'set content.user_stylesheets ' + str(css[0]) )
# leader - sl for light mode solarized
config.bind(leader + 'sl', 'set content.user_stylesheets ' + str(css[1]) )
# Enable and disable javascript
config.bind(leader + "js", "config-cycle content.javascript.enabled true false")
# Reload this config
config.bind(leader + "VV", "config-source")
c.url.searchengines = {
"DEFAULT": "https://duckduckgo.com/?q={}",
"g": "https://www.google.com/search?q={}",
"r": "https://old.reddit.com/r/{}",
"w": "https://en.wikipedia.org/w/index.php?search={}",
"gt": "https://translate.google.com/#auto/de/{}",
"gh": "https://github.com/search?q={}",
"al": "https://wiki.archlinux.org/index.php/{}",
"aur": "https://aur.archlinux.org/packages/?K={}",
"yt": "https://www.youtube.com/results?search_query={}",
"maps": "https://www.google.fr/maps?q={}",
"gol": "https://golang.org/pkg/{}/",
}