From a124b1f7b14f632421aa2a6db1d109b04d20da75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 16 Mar 2021 06:09:15 +0300 Subject: qutebrowser config Updated config and moved js whitelist to external file. --- dotfiles/.config/qutebrowser/config.py | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py index 461a637..121b05d 100644 --- a/dotfiles/.config/qutebrowser/config.py +++ b/dotfiles/.config/qutebrowser/config.py @@ -1,3 +1,4 @@ +import os import subprocess # Still load settings configured via autoconfig.yml @@ -32,28 +33,12 @@ c.content.notifications = False ## Disable JS by default c.content.javascript.enabled = False -# Enable JS for certain sites -js_whitelist = [ - "*://localhost/*", - "*://127.0.0.1/*", - "*://github.com/*", - "*://duckduckgo.com/*", - "*://*.youtube.com/*", - "*://*.google.com/*", - '*://*.namecheap.com/*', - '*://*.wikipedia.org/*', - '*://yandex.ru/*', - '*://*.yaroslavps.com/*', - '*://*.openedu.ru/*', - '*://developer.mozilla.org/*', - '*://*.vultr.com/*', - '*://*.ifmo.ru/*', - '*://*.4chan.org/*', - '*://*.4channel.org/*', -] -for site in js_whitelist: - with config.pattern(site) as p: - p.content.javascript.enabled = True +# Read separate whitelist file and enable JS for those sites +with open(os.path.expanduser("~/.config/qutebrowser/jswhitelist")) as f: + for line in f: + site = line.rstrip('\n') + with config.pattern(site) as p: + p.content.javascript.enabled = True ## Disable 3rd party cookies c.content.cookies.accept = "no-3rdparty" @@ -91,7 +76,7 @@ c.url.start_pages = "https://srx.yaroslavps.com" c.fonts.default_size = "10pt" ## Prefer dark mode in websites that support it -c.colors.webpage.prefers_color_scheme_dark = True +c.colors.webpage.preferred_color_scheme = "dark" ## Background color of the completion widget category headers. ## Type: QssColor -- cgit v1.2.3