From e0ff095b8ca08ee5ebfa520115424e827d3bbeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Sun, 24 Jan 2021 06:37:34 +0300 Subject: qutebrowser config * JS whitelist * Binding to open links externally * Chromium user agent --- dotfiles/.config/qutebrowser/config.py | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py index 282aec5..79d35e2 100644 --- a/dotfiles/.config/qutebrowser/config.py +++ b/dotfiles/.config/qutebrowser/config.py @@ -28,9 +28,37 @@ ultramar = { 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 + +## Disable 3rd party cookies +c.content.cookies.accept = "no-3rdparty" + +## Pretend that we are Chrome +c.content.headers.user_agent = "Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}" + ## Downloads # Automatically remove finished downloads from list @@ -397,6 +425,11 @@ c.colors.tabs.selected.odd.fg = ultramar['dark0'] config.bind('', 'tab-focus 9', mode='normal') config.bind('', 'tab-focus -1', mode='normal') +# Open links externally with xdg-open (i.e. to open youtube videos with mpv, or +# images with sxiv or imv, etc.) +config.bind(',x', 'spawn xdg-open {url}') +config.bind(',X', 'hint links spawn xdg-open {hint-url}') + # Bindings for Russian keyboard layout (my most used bindings) config.bind('Р', 'back', mode='normal') -- cgit v1.2.3