]> git.rmz.io Git - dotfiles.git/commitdiff
qutebrowser: add proxy-pac to qt.args
authorSamir Benmendil <me@rmz.io>
Tue, 26 Jan 2021 00:15:35 +0000 (00:15 +0000)
committerSamir Benmendil <me@rmz.io>
Tue, 26 Jan 2021 00:25:01 +0000 (00:25 +0000)
This defines which proxy (if at all) to use for which urls. It requires
qutebrowser to be patched to not load it's own proxy handling as that
seems to overwrite this.

This used to be set with QTWEBENGINE_CHROMIUM_FLAGS environment variable
in an untracked qutebrowser wrapper in PATH. It caused some issues with
darkmode though, as it seems that this env variable is not overwritten
when already set, and the correct darkmode settings are not being passed
to blink.

Setting the proxy file as qt.args works also with darkmode.

qutebrowser/config.py
qutebrowser/proxy.pac [new file with mode: 0644]

index a7d422b6c5bc264898b515820ba24964b237f77a..2378f63ef3afe34fda5b4af0dfca533b10b401b1 100644 (file)
@@ -1496,7 +1496,7 @@ c.input.partial_timeout = 5000
 ## https://peter.sh/experiments/chromium-command-line-switches/ for a
 ## list) will work.
 ## Type: List of String
-# c.qt.args = []
+c.qt.args = [str('proxy-pac-url=file://' / config.configdir / 'proxy.pac')]
 
 ## Additional environment variables to set. Setting an environment
 ## variable to null/None will unset it.
diff --git a/qutebrowser/proxy.pac b/qutebrowser/proxy.pac
new file mode 100644 (file)
index 0000000..8d2ec82
--- /dev/null
@@ -0,0 +1,11 @@
+function FindProxyForURL(url, host) {
+    if (shExpMatch(host, "*slack*")) {
+        return "DIRECT";
+    }
+    if (shExpMatch(host, "*focalpointpositioning*"))
+    {
+        return "SOCKS5 localhost:1080";
+    }
+
+    return "DIRECT";
+}