Skip to content
Snippets Groups Projects

Qutebrowser Config

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Jan Harasym
    config.py 9.70 KiB
    import os
    # Documentation:
    #   qute://help/configuring.html
    #   qute://help/settings.html
    
    # Uncomment this to still load settings configured via autoconfig.yml
    # config.load_autoconfig()
    config.load_autoconfig(False)
    
    config.source('nord-qutebrowser.py')
    
    # Value to send in the `Accept-Language` header.
    # Type: String
    c.content.headers.accept_language = 'en-GB,en'
    
    ## Enable JavaScript.
    ## Type: Bool
    #config.set('content.javascript.enabled', True, 'file://*')
    #
    ## Enable JavaScript.
    ## Type: Bool
    #config.set('content.javascript.enabled', True, 'chrome://*/*')
    #
    ## Enable JavaScript.
    ## Type: Bool
    #config.set('content.javascript.enabled', True, 'qute://*/*')
    #
    ## Enable JavaScript.
    ## Type: Bool
    #config.set('content.javascript.enabled', True, 'https://*.google.com/*')
    #config.set('content.javascript.enabled', True, 'https://gitlab-ncsa.ubisoft.org/*')
    ##config.set('content.javascript.enabled', True, 'https://git.*.com/*')
    #config.set('content.javascript.enabled', True, 'https://git.tctd2.ubisoft.com/*')
    #config.set('content.javascript.enabled', True, 'https://*.github.com/*')
    #config.set('content.javascript.enabled', True, 'https://*.ubisoft.org/*')
    #config.set('content.javascript.enabled', True, 'https://*.ubisoft.com/*')
    #config.set('content.javascript.enabled', True, 'https://*.reddit.com/*')
    #config.set('content.javascript.enabled', True, 'https://news.ycombinator.com/*')
    #config.set('content.javascript.enabled', True, 'https://www.youtube.com/*')
    #config.set('content.javascript.enabled', True, 'https://*.ubisoft.onbe/*')
    #config.set('content.javascript.enabled', True, 'http://*.ubisoft.onbe/*')
    
    # Import user stylesheets
    #import glob
    #c.content.user_stylesheets = glob.glob(
    #        '/home/dijit/.config/qutebrowser/userstyles/*.user.css')
    
    ### FIXME: waiting for this: https://github.com/qutebrowser/qutebrowser/issues/3636
    #config.set(
    #        'content.user_stylesheets',
    #        '/home/dijit/.config/qutebrowser/userstyles/hackernews.user.css',
    #        'https://news.ycombinator.com/*'
    #        )
    #
    #config.set(
    #        'content.user_stylesheets',
    #        '/home/dijit/.config/qutebrowser/userstyles/reddit.user.css',
    #        'https://*.reddit.com/*'
    #        )
    #
    #config.set(
    #        'content.user_stylesheets',
    #        '/home/dijit/.config/qutebrowser/userstyles/github.user.css',
    #        'https://*.github.com/*'
    #        )
    #
    
    
    c.content.javascript.enabled = False
    js_whitelist = [
        "file:///home/dijit/*",
        "*://localhost/*",
        "*://127.0.0.1/*",
        "*://*.darkscience.net/*",
        "*://*.darkscience.ws/*",
        "*://*.drk.sc/*",
        "*://*.ubisoft.org/*",
        "*://*.ubisoft.onbe/*",
        "*://*.ubisoft.com/*",
        "*://*.sharkmob.com/*",
        "*://*.sharkmob.se/*",
        "*://*.sharkmob.cloud/*",
        "*://github.com/*",
        "*://gitlab.com/*",
        "*://foss.heptapod.net/*",
        "*://news.ycombinator.com/*",
        "*://duckduckgo.com/*",
        "*://*.youtube.com/*",
        "*://cmpwn.com/*",
        "*://*.cmpwn.com/*"
        "*://translate.google.com/*",
        "*://patreon.com/*",
        "*://*.patreon.com/*",
        "https://*.reddit.com/*",
        "https://registry.terraform.io/*",
        "https://console.cloud.google.com/*",
        "https://mail.google.com/mail/*",
        "*://darksky.net/*",
        "https://sharkmob.atlassian.net/*",
        "https://login.microsoftonline.com/*",
        "https://*.cloud.es.io:9243/*",
        "https://cloud.elastic.co/*",
        "https://searx.be/*",
        "https://*.terraform.io/*",
        "https://*.okta.com/*",
        "https://*.gitlab.com/*",
        "https://docs.microsoft.com/*",
        "https://devdocs.io/*",
    ]
    private_whitelist = os.path.expanduser("~/.config/qutebrowser/private-whitelist")
    if os.path.exists(private_whitelist):
        with open(private_whitelist) as f:
            js_whitelist += filter(lambda l: bool(l), f.read().split("\n"))
    
    for site in js_whitelist:
        with config.pattern(site) as p:
            p.content.javascript.enabled = True
    
    # REMOVEME: for figuring out what variables I can consume as a userscript
    with open('/tmp/qute-locals.log', 'w') as f:
        f.write(str(locals()))
    
    # Proxy to use. In addition to the listed values, you can use a
    # `socks://...` or `http://...` URL.
    # Type: Proxy
    # Valid values:
    #   - system: Use the system wide proxy.
    #   - none: Don't use any proxy
    c.content.proxy = 'system'
    
    # Where to show the downloaded files.
    # Type: VerticalPosition
    # Valid values:
    #   - top
    #   - bottom
    c.downloads.position = 'bottom'
    
    # Editor (and arguments) to use for the `open-editor` command. The
    # following placeholders are defined: * `{file}`: Filename of the file
    # to be edited. * `{line}`: Line in which the caret is found in the
    # text. * `{column}`: Column in which the caret is found in the text. *
    # `{line0}`: Same as `{line}`, but starting from index 0. * `{column0}`:
    # Same as `{column}`, but starting from index 0.
    # Type: ShellCommand
    c.editor.command = ['kitty', '-o', 'linux_display_server=wayland', '-o', 'font_size=14', 'vim', '{}']
    
    # Languages to use for spell checking. You can check for available
    # languages and install dictionaries using scripts/dictcli.py. Run the
    # script with -h/--help for instructions.
    # Type: List of String
    # Valid values:
    #   - af-ZA: Afrikaans (South Africa)
    #   - bg-BG: Bulgarian (Bulgaria)
    #   - ca-ES: Catalan (Spain)
    #   - cs-CZ: Czech (Czech Republic)
    #   - da-DK: Danish (Denmark)
    #   - de-DE: German (Germany)
    #   - el-GR: Greek (Greece)
    #   - en-AU: English (Australia)
    #   - en-CA: English (Canada)
    #   - en-GB: English (United Kingdom)
    #   - en-US: English (United States)
    #   - es-ES: Spanish (Spain)
    #   - et-EE: Estonian (Estonia)
    #   - fa-IR: Farsi (Iran)
    #   - fo-FO: Faroese (Faroe Islands)
    #   - fr-FR: French (France)
    #   - he-IL: Hebrew (Israel)
    #   - hi-IN: Hindi (India)
    #   - hr-HR: Croatian (Croatia)
    #   - hu-HU: Hungarian (Hungary)
    #   - id-ID: Indonesian (Indonesia)
    #   - it-IT: Italian (Italy)
    #   - ko: Korean
    #   - lt-LT: Lithuanian (Lithuania)
    #   - lv-LV: Latvian (Latvia)
    #   - nb-NO: Norwegian (Norway)
    #   - nl-NL: Dutch (Netherlands)
    #   - pl-PL: Polish (Poland)
    #   - pt-BR: Portuguese (Brazil)
    #   - pt-PT: Portuguese (Portugal)
    #   - ro-RO: Romanian (Romania)
    #   - ru-RU: Russian (Russia)
    #   - sh: Serbo-Croatian
    #   - sk-SK: Slovak (Slovakia)
    #   - sl-SI: Slovenian (Slovenia)
    #   - sq: Albanian
    #   - sr: Serbian
    #   - sv-SE: Swedish (Sweden)
    #   - ta-IN: Tamil (India)
    #   - tg-TG: Tajik (Tajikistan)
    #   - tr-TR: Turkish (Turkey)
    #   - uk-UA: Ukrainian (Ukraine)
    #   - vi-VN: Vietnamese (Viet Nam)
    c.spellcheck.languages = ['en-GB', 'en-US']
    
    # Hide the statusbar unless a message is shown.
    # Type: String
    # Valid values:
    #   - in-mode
    #   - always
    #   - hide
    c.statusbar.show = 'in-mode'
    
    # Switch between tabs using the mouse wheel.
    # Type: Bool
    c.tabs.mousewheel_switching = False
    
    # Position of the tab bar.
    # Type: Position
    # Valid values:
    #   - top
    #   - bottom
    #   - left
    #   - right
    c.tabs.position = 'top'
    
    # When to show the tab bar.
    # Type: String
    # Valid values:
    #   - always: Always show the tab bar.
    #   - never: Always hide the tab bar.
    #   - multiple: Hide the tab bar if only one tab is open.
    #   - switching: Show the tab bar when switching tabs.
    c.tabs.show = 'multiple'
    
    # Page to open if :open -t/-b/-w is used without URL. Use `about:blank`
    # for a blank page.
    # Type: FuzzyUrl
    c.url.default_page = 'https://google.com/ncr'
    
    # Search engines which can be used via the address bar. Maps a search
    # engine name (such as `DEFAULT`, or `ddg`) to a URL with a `{}`
    # placeholder. The placeholder will be replaced by the search term, use
    # `{{` and `}}` for literal `{`/`}` signs. The search engine named
    # `DEFAULT` is used when `url.auto_search` is turned on and something
    # else than a URL was entered to be opened. Other search engines can be
    # used by prepending the search engine name to the search term, e.g.
    # `:open google qutebrowser`.
    # Type: Dict
    c.url.searchengines = {
            'DEFAULT': 'https://google.com/search?q={}', 
            #'DEFAULT': 'https://searx.be/search?q={}&categories=general&language=en-GB', 
            'ddg': 'https://duckduckgo.com/?q={}',
            #'rust': 'https://docs.rs/releases/search?query={}',
            }
    
    # Page(s) to open at the start.
    # Type: List of FuzzyUrl, or FuzzyUrl
    c.url.start_pages = 'https://google.com/ncr'
    
    # Bindings for normal mode
    os.environ['MPV_COMMAND'] = '/home/dijit/bin/umpv'
    config.bind('m', 'spawn --userscript /usr/share/qutebrowser/userscripts/view_in_mpv')
    config.bind(';m', 'spawn --userscript /usr/share/qutebrowser/userscripts/view_in_mpv')
    
    config.bind(';t', 'hint userscript link /home/dijit/.local/share/qutebrowser/userscripts/translate')
    config.bind(';T', 'hint userscript all /home/dijit/.local/share/qutebrowser/userscripts/translate --text')
    config.bind('<Ctrl+T>', 'spawn --userscript /home/dijit/.local/share/qutebrowser/userscripts/translate')
    config.bind('<Ctrl+Shift+T>', 'spawn --userscript /home/dijit/.local/share/qutebrowser/userscripts/translate --text')
    
    #config.set('content.headers.user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecho/20100101 Firefox/57.0', 'https://accounts.google.com/*')
    c.downloads.open_dispatcher = "/usr/bin/xdg-open"
    
    #c.fonts.default_family = "Fira Code"
    c.fonts.default_family = "Berkeley Mono"
    
    c.fonts.tabs.selected = "9pt 'IBM Plex Sans Light Regular'"
    c.fonts.tabs.unselected = "8pt 'IBM Plex Sans Light Regular'"
    #c.fonts.web.family.fixed = "IBM Plex Sans Light Regular"
    c.fonts.web.family.fixed = "Berkeley Mono"
    c.fonts.web.family.sans_serif = "IBM Plex"
    c.fonts.web.family.serif = "DejaVu Serif"
    
    # Default:
    c.qt.chromium.process_model = 'single-process'
    #c.qt.chromium.process_model = 'process-per-site-instance'
    #c.qt.chromium.process_model = 'process-per-site'
    #c.qt.args = ["use-gl=egl", "enable-accelerated-video-decode", "ignore-gpu-blocklist", "enable-gpu-rasterization"]
    c.tabs.padding = {"bottom": 2, "left": 5, "right": 5, "top": 2}
    
    c.content.webgl = False
    
    c.qt.force_platform = "wayland"
    nord-qutebrowser.py 9.46 KiB
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment