dotfiles/qutebrowser/.config/qutebrowser/config.py
Marty Oehme d71e4a19fb
qutebrowser: Add sending to outline command
Added a command to send the current page to the outline service, which
acts as a readability layer (and lets you read e.g. medium articles
without pulling your hair out).

Just use the `send-to-outline` command, or use keymapping <leader>bo to
send the current page to outline.
2021-03-27 22:25:46 +01:00

183 lines
6.4 KiB
Python

import os
from qutebrowser.config.config import ConfigContainer # noqa: F401
from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# load additional settings configured via autoconfig.yml
config.load_autoconfig()
c.completion.web_history.max_items = 1000
c.hints.uppercase = True
c.content.blocking.enabled = True
c.content.blocking.adblock.lists = [
"http://www.malwaredomainlist.com/hostslist/hosts.txt",
"http://someonewhocares.org/hosts/hosts",
"http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext",
"https://secure.fanboy.co.nz/fanboy-cookiemonster.txt",
]
c.content.blocking.hosts.lists = [
"http://winhelp2002.mvps.org/hosts.zip",
"http://malwaredomains.lehigh.edu/files/justdomains.zip",
]
c.content.blocking.whitelist = ["piwik.org"]
c.content.autoplay = False
c.content.pdfjs = False
c.content.javascript.enabled = False
js_whitelist = [
"*://*.youtube.com/*",
"*://127.0.0.1/*",
"*://asciinema.org/*",
"*://calendar.google.com/*",
"*://clockify.me/tracker*",
"*://darksky.net/*",
"*://deepl.com/*",
"*://duckduckgo.com/*",
"*://fosstodon.org/*",
"*://github.com/*",
"*://gitlab.com/*",
"*://localhost/*",
"*://mail.google.com/*",
"*://maps.google.com/*",
"*://*.martyoeh.me/*",
"*://news.ycombinator.com/*",
"*://old.reddit.com/*",
"*://todoist.com/*",
"*://toggl.com/*",
"*://translate.google.com/*",
"chrome://*/*",
"file://*",
"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}"]
# LOOK
# ----
# Tab-Bar
# have tab bar on the right, not on the top
c.tabs.background = True
c.tabs.title.format = "{index} {audio}{perc}{current_title}"
c.tabs.position = "right"
c.tabs.width = "15%"
c.colors.webpage.bg = "#555555"
# 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(
leader + "tt",
"config-cycle -t tabs.show always switching;; config-cycle -t statusbar.show in-mode always",
)
config.bind(leader + "th", "set tabs.position bottom")
config.bind(leader + "tH", "set tabs.position top")
config.bind(leader + "tv", "set tabs.position right")
config.bind(leader + "tV", "set tabs.position left")
# [M]edia shortcuts - watch, queue, download media
# bind mpv to play the current page/links, using a single instance which queues the next link passed
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 {hint-url}",
)
# 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"
# edit current form field in vim
config.bind(leader + "e", "open-editor")
# bookmarklet aliases:
# currently the idea is to prefix bookmarklets with b (as in open "bookmarklet")
# wallabag add current page, either with walla command, or <leader>bw
c.aliases["add-wallabag"] = "spawn --userscript wallabag_add.sh"
config.bind(leader + "bw", "add-wallabag", mode="normal")
# add to (my) shaarli instance
c.aliases["add-shaarli"] = "spawn --userscript shaarli_add.sh"
config.bind(leader + "bs", "add-shaarli", mode="normal")
# re-opens the current page on the web archive overview page
c.aliases["send-to-archive"] = "open https://web.archive.org/web/{url}"
config.bind(leader + "ba", "send-to-archive", mode="normal")
# sends current page to outline and thus through readability mode
c.aliases["send-to-outline"] = "open https://outline.com/{url}"
config.bind(leader + "bo", "send-to-outline", mode="normal")
# translate current page / selection with google translate
c.aliases["translate-page"] = "spawn --userscript translate_google.sh"
c.aliases["translate-selection"] = "spawn --userscript translate_google.sh --text"
config.bind(leader + "bg", "translate-page", mode="normal")
config.bind(leader + "bG", "translate-selection", mode="normal")
# save current page to pdf file
c.aliases["printpdf"] = "spawn --userscript pagetopdf.sh"
# set to gp, to mirror gd (download) just as go-Pdfdownload
config.bind("gp", "printpdf", mode="normal")
# open last download
config.bind(leader + "o", "download-open")
# set stylesheets for the browser to use
# leader - ss to remove all applied stylesheets
config.bind(
leader + "s",
"config-cycle content.user_stylesheets " + 'stylesheets/stylesheet.css ""',
)
# 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://search.martyoeh.me/?q={}",
"l": "https://links.martyoeh.me/?searchterm={}&searchtags=",
"ddg": "https://duckduckgo.com/?q={}",
"d": "https://www.dict.cc/?s={}",
"t": "https://www.thesaurus.com/browse/{}",
"gt": "https://translate.google.com/#auto/de/{}",
"dt": "https://www.deepl.com/translator#en/de/{}",
"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/{}/",
"man": "https://manned.org/browse/search?q={}",
"lib": "http://libgen.fun/search.php?req={}",
"sci": "https://sci-hub.do/{}",
"alt": "https://alternativeto.net/software/{}/?license=opensource",
"hn": "https://hn.algolia.com/?q={}",
"kb": "https://soeg.kb.dk/discovery/search?query=any,contains,{}&tab=Everything&search_scope=MyInst_and_CI&vid=45KBDK_KGL:KGL&offset=0&lang=en",
}
# give the browser nice theme colors
config.source("colorscheme.py")