X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/ca46e0efb3412594540acf2d02f7cc3030965c98..1c89bd14849b914e9c62febdb065fbf66db53aed:/qutebrowser/config.py diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 1fb0932..2378f63 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -5,7 +5,30 @@ ## This is here so configs done via the GUI are still loaded. ## Remove it to not load settings done via the GUI. -# config.load_autoconfig() +config.load_autoconfig() + +try: + from qutebrowser.api import interceptor, message + from PyQt5.QtCore import QUrl + + def intercept(info: interceptor.Request): + url = info.request_url + if url.host() == "twitter.com": + url.setHost("nitter.net") + message.info("Redirecting to " + url.toString()) + info.redirect(url) + if url.host() == "xkcd.com": + url.setHost("m.xkcd.com") + message.info("Redirecting to " + url.toString()) + info.redirect(url) + if url.host() == "www.bristolpost.co.uk": + url.setUrl("https://outline.com/" + url.toString()) + message.info("Redirecting to " + url.toString()) + info.redirect(url) + + interceptor.register(intercept) +except ImportError: + pass ## Aliases for commands. The keys of the given dictionary are the ## aliases, while the values are the commands they map to. @@ -13,30 +36,38 @@ c.aliases = {'w': 'session-save', 'quit': 'close', 'q': 'close', + 'qa': 'quit', 'wq': 'quit --save', + 'wqa': 'quit --save', 'mpv': 'spawn --userscript ~/src/qutebrowser/misc/userscripts/view_in_mpv' } -## How often (in milliseconds) to auto-save config/cookies/etc. +## Time interval (in milliseconds) between auto-saves of +## config/cookies/etc. ## Type: Int # c.auto_save.interval = 15000 -## Always restore open sites when qutebrowser is reopened. +## 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 = True -## The backend to use to display websites. qutebrowser supports two -## different web rendering engines / backends, QtWebKit and QtWebEngine. -## QtWebKit was discontinued by the Qt project with Qt 5.6, but picked up -## as a well maintained fork: https://github.com/annulen/webkit/wiki - +## Backend to use to display websites. qutebrowser supports two different +## web rendering engines / backends, QtWebKit and QtWebEngine. QtWebKit +## was discontinued by the Qt project with Qt 5.6, but picked up as a +## well maintained fork: https://github.com/annulen/webkit/wiki - ## qutebrowser only supports the fork. QtWebEngine is Qt's official -## successor to QtWebKit. It's slightly more resource hungry that +## successor to QtWebKit. It's slightly more resource hungry than ## QtWebKit and has a couple of missing features in qutebrowser, but is -## generally the preferred choice. This setting requires a restart. +## generally the preferred choice. ## Type: String ## Valid values: -## - webengine: Use QtWebEngine (based on Chromium) -## - webkit: Use QtWebKit (based on WebKit, similar to Safari) +## - webengine: Use QtWebEngine (based on Chromium). +## - webkit: Use QtWebKit (based on WebKit, similar to Safari). # c.backend = 'webengine' ## This setting can be used to map keys to other keys. When the key used @@ -46,7 +77,7 @@ c.auto_save.session = True ## when a key is bound (via `bindings.default` or `bindings.commands`), ## the mapping is ignored. ## Type: Dict -# c.bindings.key_mappings = {'': '', '': '', '': '', '': '', '': '', '': '', '': '', '': ''} +# c.bindings.key_mappings = {'': '', '': '', '': '', '': '', '': '', '': '', '': '', '': '', '': ''} ## Background color of the completion widget category headers. ## Type: QssColor @@ -68,9 +99,10 @@ c.auto_save.session = True ## Type: QssColor # c.colors.completion.even.bg = '#333333' -## Text color of the completion widget. -## Type: QtColor -# c.colors.completion.fg = 'white' +## Text color of the completion widget. May be a single color to use for +## all columns or a list of three colors, one for each column. +## Type: List of QtColor, or QtColor +# c.colors.completion.fg = ['white', 'white', 'white'] ## Background color of the selected completion item. ## Type: QssColor @@ -80,7 +112,7 @@ c.auto_save.session = True ## Type: QssColor # c.colors.completion.item.selected.border.bottom = '#bbbb00' -## Top border color of the completion widget category headers. +## Top border color of the selected completion item. ## Type: QssColor # c.colors.completion.item.selected.border.top = '#bbbb00' @@ -88,22 +120,56 @@ c.auto_save.session = True ## Type: QtColor # c.colors.completion.item.selected.fg = 'black' +## Foreground color of the matched text in the selected completion item. +## Type: QtColor +# c.colors.completion.item.selected.match.fg = '#ff4444' + ## Foreground color of the matched text in the completion. -## Type: QssColor +## Type: QtColor # c.colors.completion.match.fg = '#ff4444' ## Background color of the completion widget for odd rows. ## Type: QssColor # c.colors.completion.odd.bg = '#444444' -## Color of the scrollbar in completion view +## Color of the scrollbar in the completion view. ## Type: QssColor # c.colors.completion.scrollbar.bg = '#333333' -## Color of the scrollbar handle in completion view. +## Color of the scrollbar handle in the completion view. ## Type: QssColor # c.colors.completion.scrollbar.fg = 'white' +## Background color of disabled items in the context menu. If set to +## null, the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.disabled.bg = None + +## Foreground color of disabled items in the context menu. If set to +## null, the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.disabled.fg = None + +## Background color of the context menu. If set to null, the Qt default +## is used. +## Type: QssColor +# c.colors.contextmenu.menu.bg = None + +## Foreground color of the context menu. If set to null, the Qt default +## is used. +## Type: QssColor +# c.colors.contextmenu.menu.fg = None + +## Background color of the context menu's selected item. If set to null, +## the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.selected.bg = None + +## Foreground color of the context menu's selected item. If set to null, +## the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.selected.fg = None + ## Background color for the download bar. ## Type: QssColor # c.colors.downloads.bar.bg = 'black' @@ -160,7 +226,7 @@ c.auto_save.session = True # c.colors.hints.fg = 'black' ## Font color for the matched part of hints. -## Type: QssColor +## Type: QtColor # c.colors.hints.match.fg = 'green' ## Background color of the keyhint widget. @@ -195,7 +261,7 @@ c.auto_save.session = True ## Type: QssColor # c.colors.messages.info.border = '#333333' -## Foreground color an info message. +## Foreground color of an info message. ## Type: QssColor # c.colors.messages.info.fg = 'white' @@ -203,11 +269,11 @@ c.auto_save.session = True ## Type: QssColor # c.colors.messages.warning.bg = 'darkorange' -## Border color of an error message. +## Border color of a warning message. ## Type: QssColor # c.colors.messages.warning.border = '#d47300' -## Foreground color a warning message. +## Foreground color of a warning message. ## Type: QssColor # c.colors.messages.warning.fg = 'white' @@ -253,7 +319,7 @@ c.colors.prompts.bg = '#333333' ## Background color of the statusbar in private browsing + command mode. ## Type: QssColor -# c.colors.statusbar.command.private.bg = 'grey' +# c.colors.statusbar.command.private.bg = 'darkslategray' ## Foreground color of the statusbar in private browsing + command mode. ## Type: QssColor @@ -275,6 +341,14 @@ c.colors.prompts.bg = '#333333' ## Type: QssColor # c.colors.statusbar.normal.fg = 'white' +## Background color of the statusbar in passthrough mode. +## Type: QssColor +# c.colors.statusbar.passthrough.bg = 'darkblue' + +## Foreground color of the statusbar in passthrough mode. +## Type: QssColor +# c.colors.statusbar.passthrough.fg = 'white' + ## Background color of the statusbar in private browsing mode. ## Type: QssColor # c.colors.statusbar.private.bg = '#666666' @@ -314,7 +388,7 @@ c.colors.prompts.bg = '#333333' # c.colors.statusbar.url.warn.fg = 'yellow' ## Background color of the tab bar. -## Type: QtColor +## Type: QssColor # c.colors.tabs.bar.bg = '#555555' ## Background color of unselected even tabs. @@ -354,6 +428,38 @@ c.colors.prompts.bg = '#333333' ## Type: QtColor # c.colors.tabs.odd.fg = 'white' +## Background color of pinned unselected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.even.bg = 'darkseagreen' + +## Foreground color of pinned unselected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.even.fg = 'white' + +## Background color of pinned unselected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.odd.bg = 'seagreen' + +## Foreground color of pinned unselected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.odd.fg = 'white' + +## Background color of pinned selected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.even.bg = 'black' + +## Foreground color of pinned selected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.even.fg = 'white' + +## Background color of pinned selected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.odd.bg = 'black' + +## Foreground color of pinned selected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.odd.fg = 'white' + ## Background color of selected even tabs. ## Type: QtColor # c.colors.tabs.selected.even.bg = 'black' @@ -371,29 +477,131 @@ c.colors.prompts.bg = '#333333' # c.colors.tabs.selected.odd.fg = 'white' ## Background color for webpages if unset (or empty to use the theme's -## color) +## color). ## Type: QtColor # c.colors.webpage.bg = 'white' -## How many commands to save in the command history. 0: no history / -1: +## Which algorithm to use for modifying how colors are rendered with +## darkmode. The `lightness-cielab` value was added with QtWebEngine 5.14 +## and is treated like `lightness-hsl` with older QtWebEngine versions. +## Type: String +## Valid values: +## - lightness-cielab: Modify colors by converting them to CIELAB color space and inverting the L value. Not available with Qt < 5.14. +## - lightness-hsl: Modify colors by converting them to the HSL color space and inverting the lightness (i.e. the "L" in HSL). +## - brightness-rgb: Modify colors by subtracting each of r, g, and b from their maximum value. +# c.colors.webpage.darkmode.algorithm = 'lightness-cielab' + +## Contrast for dark mode. This only has an effect when +## `colors.webpage.darkmode.algorithm` is set to `lightness-hsl` or +## `brightness-rgb`. +## Type: Float +# c.colors.webpage.darkmode.contrast = 0.0 + +## Render all web contents using a dark theme. Example configurations +## from Chromium's `chrome://flags`: - "With simple HSL/CIELAB/RGB-based +## inversion": Set `colors.webpage.darkmode.algorithm` accordingly. - +## "With selective image inversion": Set +## `colors.webpage.darkmode.policy.images` to `smart`. - "With selective +## inversion of non-image elements": Set +## `colors.webpage.darkmode.threshold.text` to 150 and +## `colors.webpage.darkmode.threshold.background` to 205. - "With +## selective inversion of everything": Combines the two variants above. +## Type: Bool +# c.colors.webpage.darkmode.enabled = False + +## Render all colors as grayscale. This only has an effect when +## `colors.webpage.darkmode.algorithm` is set to `lightness-hsl` or +## `brightness-rgb`. +## Type: Bool +# c.colors.webpage.darkmode.grayscale.all = False + +## Desaturation factor for images in dark mode. If set to 0, images are +## left as-is. If set to 1, images are completely grayscale. Values +## between 0 and 1 desaturate the colors accordingly. +## Type: Float +# c.colors.webpage.darkmode.grayscale.images = 0.0 + +## Which images to apply dark mode to. With QtWebEngine 5.15.0, this +## setting can cause frequent renderer process crashes due to a +## https://codereview.qt-project.org/c/qt/qtwebengine- +## chromium/+/304211[bug in Qt]. +## Type: String +## Valid values: +## - always: Apply dark mode filter to all images. +## - never: Never apply dark mode filter to any images. +## - smart: Apply dark mode based on image content. Not available with Qt 5.15.0. +# c.colors.webpage.darkmode.policy.images = 'smart' + +## Which pages to apply dark mode to. +## Type: String +## Valid values: +## - always: Apply dark mode filter to all frames, regardless of content. +## - smart: Apply dark mode filter to frames based on background color. +# c.colors.webpage.darkmode.policy.page = 'smart' + +## Threshold for inverting background elements with dark mode. Background +## elements with brightness above this threshold will be inverted, and +## below it will be left as in the original, non-dark-mode page. Set to +## 256 to never invert the color or to 0 to always invert it. Note: This +## behavior is the opposite of `colors.webpage.darkmode.threshold.text`! +## Type: Int +# c.colors.webpage.darkmode.threshold.background = 0 + +## Threshold for inverting text with dark mode. Text colors with +## brightness below this threshold will be inverted, and above it will be +## left as in the original, non-dark-mode page. Set to 256 to always +## invert text color or to 0 to never invert text color. +## Type: Int +# c.colors.webpage.darkmode.threshold.text = 256 + +## Force `prefers-color-scheme: dark` colors for websites. +## Type: Bool +c.colors.webpage.prefers_color_scheme_dark = True + +## Number of commands to save in the command history. 0: no history / -1: ## unlimited ## Type: Int # c.completion.cmd_history_max_items = 100 -## The height of the completion, in px or as percentage of the window. +## Delay (in milliseconds) before updating completions after typing a +## character. +## Type: Int +# c.completion.delay = 0 + +## Default filesystem autocomplete suggestions for :open. The elements of +## this list show up in the completion window under the Filesystem +## category when the command line contains `:open` but no argument. +## Type: List of String +# c.completion.favorite_paths = [] + +## Height (in pixels or as percentage of the window) of the completion. ## Type: PercOrInt c.completion.height = 150 +## Minimum amount of characters needed to update completions. +## Type: Int +# c.completion.min_chars = 1 + +## Which categories to show (in which order) in the :open completion. +## Type: FlagList +## Valid values: +## - searchengines +## - quickmarks +## - bookmarks +## - history +## - filesystem +# c.completion.open_categories = ['searchengines', 'quickmarks', 'bookmarks', 'history', 'filesystem'] + ## Move on to the next part when there's only one possible completion ## left. ## Type: Bool c.completion.quick = False -## Padding of scrollbar handle in the completion window (in px). +## Padding (in pixels) of the scrollbar handle in the completion window. ## Type: Int # c.completion.scrollbar.padding = 2 -## Width of the scrollbar in the completion window (in px). +## Width (in pixels) of the scrollbar in the completion window. ## Type: Int # c.completion.scrollbar.width = 12 @@ -410,16 +618,32 @@ c.completion.quick = False ## Type: Bool c.completion.shrink = True -## How to format timestamps (e.g. for the history completion). -## Type: TimestampTemplate -# c.completion.timestamp_format = '%Y-%m-%d' +## Format of timestamps (e.g. for the history completion). See +## https://sqlite.org/lang_datefunc.html and +## https://docs.python.org/3/library/datetime.html#strftime-strptime- +## behavior for allowed substitutions, qutebrowser uses both sqlite and +## Python to format its timestamps. +## Type: String +# c.completion.timestamp_format = '%Y-%m-%d %H:%M' + +## Execute the best-matching command on a partial match. +## Type: Bool +# c.completion.use_best_match = False + +## A list of patterns which should not be shown in the history. This only +## affects the completion. Matching URLs are still saved in the history +## (and visible on the qute://history page), but hidden in the +## completion. Changing this setting will cause the completion history to +## be regenerated on the next start, which will take a short while. +## Type: List of UrlPattern +# c.completion.web_history.exclude = [] -## How many URLs to show in the web history. 0: no history / -1: +## Number of URLs to show in the web history. 0: no history / -1: ## unlimited ## Type: Int -# c.completion.web_history_max_items = -1 +# c.completion.web_history.max_items = -1 -## Whether quitting the application requires a confirmation. +## Require a confirmation before quitting the application. ## Type: ConfirmQuit ## Valid values: ## - always: Always show a confirmation. @@ -428,38 +652,106 @@ c.completion.shrink = True ## - never: Never show a confirmation. c.confirm_quit = ['downloads'] -## Whether support for the HTML 5 web application cache feature is -## enabled. An application cache acts like an HTTP cache in some sense. -## For documents that use the application cache via JavaScript, the -## loader engine will first ask the application cache for the contents, -## before hitting the network. +## Automatically start playing `