aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-01-24 06:37:34 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-01-24 06:37:34 +0300
commite0ff095b8ca08ee5ebfa520115424e827d3bbeb0 (patch)
tree40cafdd01ada04ae80faa0c0171d9e099cab0411
parente4672d66a9302f557ce26b0a418746deffe0decc (diff)
downloadswayrice-e0ff095b8ca08ee5ebfa520115424e827d3bbeb0.tar.gz
swayrice-e0ff095b8ca08ee5ebfa520115424e827d3bbeb0.zip
qutebrowser config
* JS whitelist * Binding to open links externally * Chromium user agent
-rw-r--r--dotfiles/.config/qutebrowser/config.py35
1 files changed, 34 insertions, 1 deletions
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('<Alt-9>', 'tab-focus 9', mode='normal')
config.bind('<Alt-0>', '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')