2019-05-22 17:58:30 +00:00
|
|
|
from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
|
|
|
|
from qutebrowser.config.config import ConfigContainer # noqa: F401
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
2019-05-16 12:25:19 +00:00
|
|
|
# Autogenerated config.py
|
|
|
|
# Documentation:
|
|
|
|
# qute://help/configuring.html
|
|
|
|
# qute://help/settings.html
|
|
|
|
|
|
|
|
# Uncomment this to still load settings configured via autoconfig.yml
|
2019-05-22 17:58:30 +00:00
|
|
|
config.load_autoconfig()
|
2019-05-16 12:25:19 +00:00
|
|
|
|
2019-08-06 07:25:57 +00:00
|
|
|
c.completion.web_history.max_items = 1000
|
|
|
|
c.hints.uppercase = True
|
|
|
|
|
2019-08-29 14:44:15 +00:00
|
|
|
c.content.host_blocking.enabled = True
|
|
|
|
c.content.host_blocking.lists = [
|
|
|
|
"http://www.malwaredomainlist.com/hostslist/hosts.txt",
|
|
|
|
"http://someonewhocares.org/hosts/hosts",
|
|
|
|
"http://winhelp2002.mvps.org/hosts.zip",
|
|
|
|
"http://malwaredomains.lehigh.edu/files/justdomains.zip",
|
|
|
|
"http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext",
|
|
|
|
]
|
|
|
|
c.content.host_blocking.whitelist = ['piwik.org']
|
|
|
|
|
2019-09-01 09:03:55 +00:00
|
|
|
c.content.pdfjs = False
|
2019-08-06 07:25:57 +00:00
|
|
|
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/*",
|
2019-08-27 12:13:18 +00:00
|
|
|
"*://maps.google.com/*",
|
|
|
|
"*://mail.google.com/*",
|
2019-08-08 11:20:18 +00:00
|
|
|
"*://todoist.com/*",
|
2019-08-08 12:12:43 +00:00
|
|
|
"*://toggl.com/*",
|
2019-08-06 07:25:57 +00:00
|
|
|
"file://*",
|
|
|
|
"chrome://*/*",
|
|
|
|
"qute://*/*",
|
|
|
|
]
|
|
|
|
for page in js_whitelist:
|
|
|
|
with config.pattern(page) as p:
|
|
|
|
p.content.javascript.enabled = True
|
2019-05-16 12:25:19 +00:00
|
|
|
|
|
|
|
c.editor.command = ["alacritty", "-e", "nvim", "-f", "{file}"]
|
2019-05-16 14:14:09 +00:00
|
|
|
|
2019-05-22 17:58:30 +00:00
|
|
|
# LOOK
|
|
|
|
# ----
|
2019-05-16 14:14:09 +00:00
|
|
|
|
2019-05-22 17:58:30 +00:00
|
|
|
# Tab-Bar
|
2019-05-16 14:14:09 +00:00
|
|
|
# have tab bar on the right, not on the top
|
2019-08-06 07:25:57 +00:00
|
|
|
c.tabs.background = True
|
2019-09-29 19:40:38 +00:00
|
|
|
c.tabs.title.format = '{index} {audio}{perc}{current_title}'
|
2019-05-16 14:14:09 +00:00
|
|
|
c.tabs.position = "right"
|
2019-05-22 17:58:30 +00:00
|
|
|
c.tabs.width = "15%"
|
|
|
|
|
|
|
|
# give the browser nice nord theme colors
|
2019-08-06 07:25:57 +00:00
|
|
|
config.source('themes/nordtheme.py')
|
2019-05-22 17:58:30 +00:00
|
|
|
|
|
|
|
# Status bar
|
|
|
|
# should be visible to prevent 'jumping' bug, see https://github.com/qutebrowser/qutebrowser/issues/2236
|
|
|
|
# TODO think about implementing a simple toggle for the statusbar, like for the tabs
|
|
|
|
c.statusbar.hide = False
|
|
|
|
|
|
|
|
# CSS
|
|
|
|
DARK_STYLESHEET = config.configdir / \
|
|
|
|
"stylesheets/solarized-dark.css"
|
|
|
|
LIGHT_STYLESHEET = config.configdir / \
|
|
|
|
"stylesheets/solarized-light.css"
|
|
|
|
if DARK_STYLESHEET.exists() and LIGHT_STYLESHEET.exists():
|
|
|
|
css = [str(DARK_STYLESHEET), str(LIGHT_STYLESHEET)]
|
|
|
|
|
|
|
|
# FUNCTION
|
|
|
|
# --------
|
|
|
|
|
|
|
|
# Prevents *all* tabs from being loaded on restore, only loads on activating them
|
|
|
|
c.session.lazy_restore = True
|
|
|
|
|
|
|
|
# Binds
|
|
|
|
# 'Leader' key binding
|
|
|
|
leader = "<Space>"
|
|
|
|
|
|
|
|
# toggles ('cycles') between tabs always showing, or only when switching between them
|
|
|
|
config.bind('tt', 'config-cycle -t tabs.show always switching')
|
2019-05-16 14:14:09 +00:00
|
|
|
|
2019-08-29 14:44:15 +00:00
|
|
|
# [M]edia shortcuts - watch, queue, download media
|
|
|
|
|
2019-05-16 14:14:09 +00:00
|
|
|
# bind mpv to play the current page/links, using a single instance which queues the next link passed
|
2019-08-29 14:44:15 +00:00
|
|
|
config.bind(leader + 'M', 'spawn umpv {url}')
|
|
|
|
config.bind(leader + 'm', 'hint links spawn umpv {hint-url}')
|
|
|
|
|
|
|
|
# bind youtube-dl to download the current page/links
|
|
|
|
config.bind(leader + 'dM', 'spawn youtube-dl -o ~/videos/%(title)s.%(ext)s {url}')
|
|
|
|
config.bind(leader + 'dm', 'hint --rapid links spawn youtube-dl -o ~/videos/%(title)s.%(ext)s {url}')
|
2019-05-22 17:58:30 +00:00
|
|
|
|
|
|
|
# Let me close tabs more easily, and 'unclose' them with the same key
|
|
|
|
config.bind('x', 'tab-close', mode='normal')
|
|
|
|
config.bind('X', 'undo', mode='normal')
|
|
|
|
|
|
|
|
# Use q for quitting a tab (mimicks vim buffer) - qa is used for exiting
|
|
|
|
c.aliases["q"] = "tab-close"
|
|
|
|
# if we save sessions with w, load sessions with e (again, mimicks vim)
|
|
|
|
c.aliases["e"] = "session-load"
|
|
|
|
|
2019-05-28 09:10:03 +00:00
|
|
|
# bookmarklet aliases:
|
2019-06-04 11:28:44 +00:00
|
|
|
# currently the idea is to prefix bookmarklets with b (as in open "bookmarklet")
|
|
|
|
# wallabag add current page, either with walla command, or <leader>bw
|
2019-05-28 09:10:03 +00:00
|
|
|
c.aliases["wallabag-add"] = "spawn --userscript wallabag_add.sh"
|
2019-06-04 11:28:44 +00:00
|
|
|
config.bind(leader + 'bw', 'wallabag-add', mode='normal')
|
|
|
|
# re-opens the current page on the web archive overview page
|
|
|
|
c.aliases["archive-open"] = "open https://web.archive.org/web/{url}"
|
|
|
|
config.bind(leader + 'ba', 'archive-open', mode='normal')
|
2019-05-28 09:10:03 +00:00
|
|
|
|
2019-05-22 17:58:30 +00:00
|
|
|
# set stylesheets for the browser to use
|
|
|
|
# leader - ss to remove all applied stylesheets
|
|
|
|
config.bind(leader + 'ss', 'set content.user_stylesheets ""')
|
|
|
|
# leader - sd for dark mode solarized
|
|
|
|
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]) )
|
2019-08-06 07:25:57 +00:00
|
|
|
|
|
|
|
# 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={}",
|
2019-08-08 11:34:40 +00:00
|
|
|
"d": "https://www.dict.cc/?s={}",
|
2019-12-03 10:36:31 +00:00
|
|
|
"gt": "https://translate.google.com/#auto/de/{}",
|
|
|
|
"dt": "https://www.deepl.com/translator#en/de/{}",
|
2019-08-06 07:25:57 +00:00
|
|
|
"g": "https://www.google.com/search?q={}",
|
|
|
|
"r": "https://old.reddit.com/r/{}",
|
|
|
|
"w": "https://en.wikipedia.org/w/index.php?search={}",
|
|
|
|
"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/{}/",
|
|
|
|
}
|