dotfiles/.config/qutebrowser/config.py

429 lines
16 KiB
Python

# pylint: disable=C0111,E0601
# pyflakes: noqa
from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
from qutebrowser.config.config import ConfigContainer # noqa: F401
# import dracula.draw
import os
from urllib.request import urlopen
config: ConfigAPI = config # noqa: F821 pylint: disable=E0602,C0103
c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103
# ref: https://www.qutebrowser.org/doc/help/configuring.html
# Autogenerated config.py
#
# NOTE: config.py is intended for advanced users who are comfortable
# with manually migrating the config file on qutebrowser upgrades. If
# you prefer, you can also configure qutebrowser using the
# :set/:bind/:config-* commands without having to write a config.py
# file.
#
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Change the argument to True to still load settings configured via
# autoconfig.yml
config.load_autoconfig(False)
if not os.path.exists(config.configdir / "theme.py"):
theme = "https://raw.githubusercontent.com/catppuccin/qutebrowser/main/setup.py"
with urlopen(theme) as themehtml:
with open(config.configdir / "theme.py", "a") as file:
file.writelines(themehtml.read().decode("utf-8"))
if os.path.exists(config.configdir / "theme.py"):
import theme
theme.setup(c, 'mocha', True)
# Aliases for commands. The keys of the given dictionary are the
# aliases, while the values are the commands they map to.
# Type: Dict
c.aliases = {
'w': 'session-save --only-active-window', 'q': 'quit', 'qa': 'quit',
'wq': 'quit --save', 'wqa': 'quit --save',
'tor': 'config-cycle -p content.proxy socks://localhost:9050/ system',
'toroff': 'set content.proxy system',
'toron': 'set content.proxy socks://localhost:9050'
}
# Force a Qt platform to use. This sets the `QT_QPA_PLATFORM`
# environment variable and is useful to force using the XCB plugin when
# running QtWebEngine on Wayland.
# Type: String
c.qt.force_platform = 'wayland'
# Always restore open sites when qutebrowser is reopened. Without this
# option set, `:wq` (`:quit --save`) needs to be used to save open tabs
# (and restore them), while quitting qutebrowser in any other way will
# not save/restore the session. By default, this will save to the
# session which was last loaded. This behavior can be customized via the
# `session.default_name` setting.
# Type: Bool
c.auto_save.session = False
c.session.lazy_restore = True
# Automatically start playing `<video>` elements.
# Type: Bool
c.content.autoplay = False
# Which cookies to accept. With QtWebEngine, this setting also controls
# other features with tracking capabilities similar to those of cookies;
# including IndexedDB, DOM storage, filesystem API, service workers, and
# AppCache. Note that with QtWebKit, only `all` and `never` are
# supported as per-domain values. Setting `no-3rdparty` or `no-
# unknown-3rdparty` per-domain on QtWebKit will have the same effect as
# `all`. If this setting is used with URL patterns, the pattern gets
# applied to the origin/first party URL of the page making the request,
# not the request URL. With QtWebEngine 5.15.0+, paths will be stripped
# from URLs, so URL patterns using paths will not match. With
# QtWebEngine 5.15.2+, subdomains are additionally stripped as well, so
# you will typically need to set this setting for `example.com` when the
# cookie is set on `somesubdomain.example.com` for it to work properly.
# To debug issues with this setting, start qutebrowser with `--debug
# --logfilter network --debug-flag log-cookies` which will show all
# cookies being set.
# Type: String
# Valid values:
# - all: Accept all cookies.
# - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail.
# - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. On QtWebEngine, this is the same as no-3rdparty.
# - never: Don't accept cookies at all.
config.set('content.cookies.accept', 'all', 'chrome-devtools://*')
config.set('content.cookies.accept', 'all', 'devtools://*')
# Default encoding to use for websites. The encoding must be a string
# describing an encoding such as _utf-8_, _iso-8859-1_, etc.
# Type: String
c.content.default_encoding = 'utf-8'
# Allow websites to share screen content.
# Type: BoolAsk
# Valid values:
# - true
# - false
# - ask
c.content.desktop_capture = 'ask'
# Allow websites to request geolocations.
# Type: BoolAsk
c.content.geolocation = 'ask'
# Allow websites to lock your mouse pointer.
# Type: BoolAsk
c.content.mouse_lock = 'ask'
# Allow websites to record audio.
# Type: BoolAsk
c.content.media.audio_capture = 'ask'
# Allow websites to record audio and video.
c.content.media.audio_video_capture = 'ask'
# Allow websites to record video.
# Type: BoolAsk
c.content.media.video_capture = 'ask'
# Try to pre-fetch DNS entries to speed up browsing.
# Type: Bool
c.content.dns_prefetch = True
# Custom headers for qutebrowser HTTP requests.
# Type: Dict
c.content.headers.custom = {}
# Value to send in the `DNT` header.
# Type: Bool
c.content.headers.do_not_track = True
# When to send the Referer header.
# Type: String
# Valid values:
# - always: Always send the Referer.
# - never: Never send the Referer. This is not recommended, as some sites may break.
# - same-domain: Only send the Referer for the same domain. This will still protect your privacy, but shouldn't break any sites. With QtWebEngine, the referer will still be sent for other domains, but with stripped path information.
c.content.headers.referer = 'same-domain'
# User agent to send. The following placeholders are defined: *
# `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`:
# The underlying WebKit version (set to a fixed value with
# QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for
# QtWebEngine. * `{qt_version}`: The underlying Qt version. *
# `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for
# QtWebEngine. * `{upstream_browser_version}`: The corresponding
# Safari/Chrome version. * `{qutebrowser_version}`: The currently
# running qutebrowser version. The default value is equal to the
# unchanged user agent of QtWebKit/QtWebEngine. Note that the value
# read from JavaScript is always the global value. With QtWebEngine
# between 5.12 and 5.14 (inclusive), changing the value exposed to
# JavaScript requires a restart.
# Type: FormatString
config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}', 'https://web.whatsapp.com/')
config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}; rv:90.0) Gecko/20100101 Firefox/90.0', 'https://accounts.google.com/*')
config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99 Safari/537.36', 'https://*.slack.com/*')
# Which method of blocking ads should be used. Support for Adblock Plus
# (ABP) syntax blocklists using Brave's Rust library requires the
# `adblock` Python package to be installed, which is an optional
# dependency of qutebrowser. It is required when either `adblock` or
# `both` are selected.
# Type: String
# Valid values:
# - auto: Use Brave's ABP-style adblocker if available, host blocking otherwise
# - adblock: Use Brave's ABP-style adblocker
# - hosts: Use hosts blocking
# - both: Use both hosts blocking and Brave's ABP-style adblocker
c.content.blocking.method = 'both'
# List of URLs to ABP-style adblocking rulesets. Only used when Brave's
# ABP-style adblocker is used (see `content.blocking.method`). You can
# find an overview of available lists here:
# https://adblockplus.org/en/subscriptions - note that the special
# `subscribe.adblockplus.org` links aren't handled by qutebrowser, you
# will instead need to find the link to the raw `.txt` file (e.g. by
# extracting it from the `location` parameter of the subscribe URL and
# URL-decoding it).
# Type: List of Url
c.content.blocking.adblock.lists = ['https://easylist.to/easylist/easylist.txt', 'https://easylist.to/easylist/easyprivacy.txt', 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt', 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/resource-abuse.txt', 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt', 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/quick-fixes.txt', 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt', 'https://filters.adtidy.org/extension/ublock/filters/2_without_easylist.txt', 'https://filters.adtidy.org/extension/ublock/filters/11.txt', 'https://secure.fanboy.co.nz/fanboy-annoyance.txt', 'https://filters.adtidy.org/extension/ublock/filters/4.txt', 'https://secure.fanboy.co.nz/fanboy-antifacebook.txt', 'https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/annoyances.txt', 'https://filters.adtidy.org/extension/ublock/filters/3.txt', 'https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/filters.txt', 'https://gitlab.com/curben/urlhaus-filter/raw/master/urlhaus-filter-online.txt']
# Load images automatically in web pages.
# Type: Bool
config.set('content.images', True, 'chrome-devtools://*')
# Load images automatically in web pages.
# Type: Bool
config.set('content.images', True, 'devtools://*')
# Allow JavaScript to read from or write to the clipboard. With
# QtWebEngine, writing the clipboard as response to a user interaction
# is always allowed.
# Type: Bool
c.content.javascript.can_access_clipboard = False
# Allow JavaScript to read from or write to the clipboard.
config.set('content.javascript.can_access_clipboard', True, 'git.dotya.ml')
config.set('content.javascript.can_access_clipboard', True, 'dotya.ml')
config.set('content.javascript.can_access_clipboard', True, 'drone.dotya.ml')
config.set('content.javascript.can_access_clipboard', True, 'github.com')
# Allow JavaScript to close tabs.
# Type: Bool
c.content.javascript.can_close_tabs = False
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome-devtools://*')
config.set('content.javascript.enabled', True, 'devtools://*')
config.set('content.javascript.enabled', True, 'chrome://*/*')
config.set('content.javascript.enabled', True, 'qute://*/*')
# Whether to show the origin URL for notifications.
# Type: Bool
c.content.notifications.show_origin = True
# Allow pdf.js to view PDF files in the browser. Note that the files can
# still be downloaded by clicking the download button in the pdf.js
# viewer.
# Type: Bool
c.content.pdfjs = False
# List of user stylesheet filenames to use.
# Type: List of File, or File
c.content.user_stylesheets = ['stylesheets/user.css']
# Enable WebGL.
# Type: Bool
c.content.webgl = True
# Automatically mute tabs.
# Type: Bool
c.content.mute = True
# Type: ShellCommand
c.editor.command = ['kitty', 'vim', '-f', '{file}']
# Encoding to use for the editor.
# Type: Encoding
c.editor.encoding = 'utf-8'
# Type: ShellCommand
c.fileselect.folder.command = ['kitty', 'ranger', '--choosedir={}']
# CSS border value for hints.
# Type: String
c.hints.border = '1px solid #282a36'
# CSS selectors used to determine which elements on a page should have
# hints.
# Type: Dict
c.hints.selectors = {
'all': [
'a', 'area', 'textarea', 'select', 'input:not([type="hidden"])',
'button', 'frame', 'iframe', 'img', 'link', 'summary',
'[contenteditable]:not([contenteditable="false"])', '[onclick]',
'[onmousedown]', '[role="link"]', '[role="option"]', '[role="button"]',
'[ng-click]', '[ngClick]', '[data-ng-click]', '[x-ng-click]',
'[tabindex]'
],
'links': [
'a[href]', 'area[href]', 'link[href]', '[role="link"][href]'
],
'images': [
'img'
],
'media': [
'audio', 'img', 'video'
],
'url': [
'[src]', '[href]'
],
'inputs': [
'input[type="text"]', 'input[type="date"]',
'input[type="datetime-local"]', 'input[type="email"]',
'input[type="month"]', 'input[type="number"]',
'input[type="password"]', 'input[type="search"]', 'input[type="tel"]',
'input[type="time"]', 'input[type="url"]', 'input[type="week"]',
'input:not([type])',
'[contenteditable]:not([contenteditable="false"])', 'textarea'
],
'code': [
':not(pre) > code', 'pre'
]
}
# Padding (in pixels) for the statusbar.
# Type: Padding
c.statusbar.padding = {'top': 0, 'right': 0, 'bottom': 0, 'left': 0}
# Scaling factor for favicons in the tab bar. The tab size is unchanged,
# so big favicons also require extra `tabs.padding`.
# Type: Float
c.tabs.favicons.scale = 1
# Padding (in pixels) around text for tabs.
# Type: Padding
c.tabs.padding = {'top': 0, 'right': 0, 'bottom': 0, 'left': 0}
# Position of the tab bar.
# Valid values:[top, bottom, left, right]
c.tabs.position = 'top'
# Width (in pixels or as percentage of the window) of the tab bar if
# it's vertical.
# Type: PercOrInt
c.tabs.width = '25%'
# Minimum width (in pixels) of tabs (-1 for the default minimum size
# behavior). This setting only applies when tabs are horizontal. This
# setting does not apply to pinned tabs, unless `tabs.pinned.shrink` is
# False.
# Type: Int
c.tabs.min_width = -1
# Width (in pixels) of the progress indicator (0 to disable).
# Type: Int
c.tabs.indicator.width = 1
# Type: Dict
c.url.searchengines = {
'DEFAULT': 'https://searxng.dotya.ml/search?q={}',
'ddg': 'https://duckduckgo.com/?q={}',
'wa': 'https://wiki.archlinux.org/?search={}'
}
# Hide the window decoration. This setting requires a restart on
# Wayland.
# Type: Bool
c.window.hide_decoration = False
# Type: Bool
c.window.transparent = False
# Default zoom level.
# Type: Perc
c.zoom.default = '110%'
# Available zoom levels.
# Type: List of Perc
c.zoom.levels = [
'25%', '33%', '50%', '67%', '75%', '90%', '100%', '110%', '120%',
'125%', '150%', '175%', '200%', '250%', '300%', '400%', '500%'
]
# Background color for webpages if unset (or empty to use the theme's
# color).
# Type: QtColor
c.colors.webpage.bg = '#1c1b22'
# Valid values:
# - auto: Use the system-wide color scheme setting.
# - light: Force a light theme.
# - dark: Force a dark theme.
c.colors.webpage.preferred_color_scheme = 'dark'
# Default font size to use. Whenever "default_size" is used in a font
# setting, it's replaced with the size listed here. Valid values are
# either a float value with a "pt" suffix, or an integer value with a
# "px" suffix.
# Type: String
c.fonts.default_size = '16px'
# Font used for the context menu. If set to null, the Qt default is
# used.
# Type: Font
c.fonts.contextmenu = 'FiraCode'
c.fonts.tabs.selected = 'FiraCode'
c.fonts.web.family.standard = 'FiraCode'
c.fonts.web.family.fixed = 'FiraCode'
c.fonts.web.family.sans_serif = 'FiraCode'
# Default font size (in pixels) for regular text.
# Type: Int
c.fonts.web.size.default = 18
# Default font size (in pixels) for fixed-pitch text.
# Type: Int
c.fonts.web.size.default_fixed = 20
# Hard minimum font size (in pixels).
# Type: Int
c.fonts.web.size.minimum = 16
# Bindings for normal mode
config.bind(';#', 'hint code userscript code_select.py')
config.bind(';D', 'spawn --userscript dark_mode.user ;; greasemonkey-reload')
config.bind(';G', 'hint links userscript qute-gemini')
config.bind(';b', 'hint links userscript getbib')
config.bind(';g', 'hint links userscript qute-gemini')
config.bind(';m', 'hint links spawn nohup mpv --gpu-context=wayland --hwdec=auto {hint-url}')
config.bind(',m', 'spawn nohup mpv --gpu-context=wayland --hwdec=auto {url}')
config.bind(';lh', 'spawn --userscript localhost')
config.bind(';ls', 'spawn --userscript speak')
config.bind('wa', 'open https://web.archive.org/web/{url}')
config.bind(';wa', 'hint links fill :open -t https://web.archive.org/web/{hint-url}')
config.bind('<Ctrl-=>', 'zoom-in')
config.bind('<Ctrl-->', 'zoom-out')
# save web pages in MHTML
# ref: https://www.ii.com/qutebrowser-tips-fragments/#_my_configpy_settings
config.bind(',sm', 'set-cmd-text :download --mhtml')
#dracula.draw.blood(c, {
# 'spacing': {
# # set to zero to not alter the default tab sizes
# 'vertical': 0,
# 'horizontal': 0
# }
#})