X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/62c3790178eae2f77d0bf70117d4631be9daecbb..1c89bd14849b914e9c62febdb065fbf66db53aed:/qutebrowser/config.py diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 9951404..2378f63 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -7,6 +7,29 @@ ## Remove it to not load settings done via the GUI. 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. ## Type: Dict @@ -24,7 +47,12 @@ c.aliases = {'w': 'session-save', ## 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 @@ -49,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 @@ -112,6 +140,16 @@ c.auto_save.session = True ## 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 @@ -443,6 +481,79 @@ c.colors.prompts.bg = '#333333' ## Type: QtColor # c.colors.webpage.bg = 'white' +## 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 @@ -457,6 +568,12 @@ c.colors.webpage.prefers_color_scheme_dark = True ## 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 @@ -472,7 +589,8 @@ c.completion.height = 150 ## - quickmarks ## - bookmarks ## - history -# c.completion.open_categories = ['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. @@ -501,9 +619,12 @@ c.completion.quick = False c.completion.shrink = True ## Format of timestamps (e.g. for the history completion). See -## https://sqlite.org/lang_datefunc.html for allowed substitutions. +## 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' +# c.completion.timestamp_format = '%Y-%m-%d %H:%M' ## Execute the best-matching command on a partial match. ## Type: Bool @@ -531,11 +652,61 @@ c.completion.shrink = True ## - never: Never show a confirmation. c.confirm_quit = ['downloads'] -## Automatically start playing `