]> git.friedersdorff.com Git - max/saltfiles.git/commitdiff
Manage qutebrowser configuration
authorMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 4 Jun 2019 13:45:18 +0000 (14:45 +0100)
committerMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 4 Jun 2019 13:45:18 +0000 (14:45 +0100)
states/dotfiles.sls
states/qutebrowser/files/config.py [new file with mode: 0644]
states/qutebrowser/files/noscript_disable [new file with mode: 0755]
states/qutebrowser/files/noscript_enable [new file with mode: 0755]
states/qutebrowser/gentoo.sls [new file with mode: 0644]
states/qutebrowser/init.sls [new file with mode: 0644]

index 6613eb2ddf673495abcacc6ede42476f83519a6c..09b6ce878636ac820df81f08da938c1d7d2cbe2e 100644 (file)
@@ -5,3 +5,4 @@ include:
   - vim
   - mail
   - termite
+  - qutebrowser
diff --git a/states/qutebrowser/files/config.py b/states/qutebrowser/files/config.py
new file mode 100644 (file)
index 0000000..23a7752
--- /dev/null
@@ -0,0 +1,32 @@
+config.load_autoconfig()
+
+c.auto_save.session = True
+c.content.cookies.accept = 'no-3rdparty'
+c.content.cookies.store = False
+c.content.javascript.enabled = False
+c.content.images = True
+c.editor.command = ['urxvt', '-e', 'vim', '{file}']
+c.tabs.position = 'left'
+c.url.auto_search = 'dns'
+c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?q={}'}
+c.messages.timeout = 5000
+c.tabs.background = True
+
+config.bind(',ej', 'spawn --userscript noscript_enable')
+config.bind(',dj', 'spawn --userscript noscript_disable')
+
+config.bind(',zl', 'spawn --userscript qute-pass --dmenu-invocation dmenu')
+config.bind(',zul', 'spawn --userscript qute-pass --dmenu-invocation dmenu --username-only')
+config.bind(',zpl', 'spawn --userscript qute-pass --dmenu-invocation dmenu --password-only')
+config.bind(',zol', 'spawn --userscript qute-pass --dmenu-invocation dmenu --otp-only')
+
+# Allow JS and cookies on own domain
+config.set('content.javascript.enabled', True, '*.friedersdorff.com')
+
+# Fingerprinting protection
+c.content.headers.accept_language = 'en-US,en;q=0.5'
+c.content.headers.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'
+c.content.headers.custom = {'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'}
+
+# wayland
+c.window.hide_decoration = True
diff --git a/states/qutebrowser/files/noscript_disable b/states/qutebrowser/files/noscript_disable
new file mode 100755 (executable)
index 0000000..77eb76f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+SANITIZED_URL="$(echo $QUTE_URL | sed 's/[^/]*\/\/\([^@]*@\)\?\([^/]*\).*/\2\/\*/')"
+
+echo "set -u $SANITIZED_URL content.javascript.enabled false" >> "$QUTE_FIFO"
diff --git a/states/qutebrowser/files/noscript_enable b/states/qutebrowser/files/noscript_enable
new file mode 100755 (executable)
index 0000000..25334ad
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+SANITIZED_URL="$(echo $QUTE_URL | sed 's/[^/]*\/\/\([^@]*@\)\?\([^/]*\).*/\2\/\*/')"
+
+echo "set -u $SANITIZED_URL content.javascript.enabled true" >> "$QUTE_FIFO"
diff --git a/states/qutebrowser/gentoo.sls b/states/qutebrowser/gentoo.sls
new file mode 100644 (file)
index 0000000..ab946c7
--- /dev/null
@@ -0,0 +1,18 @@
+qutebrowser useflags:
+  file.managed:
+    - name: /etc/portage/package.use/qutebrowser-salt
+    - contents:
+      - dev-qt/qtmultimedia widgets
+      - dev-python/PyQt5 multimedia
+      - dev-python/pyyaml libyaml
+      - www-client/qutebrowser scripts
+      - dev-python/PyQtWebEngine widgets
+    - user: root
+    - group: root
+    - mode: 644
+
+install qutebrowser:
+  pkg.installed:
+    - name: www-client/qutebrowser
+    - require:
+      - file: qutebrowser useflags
diff --git a/states/qutebrowser/init.sls b/states/qutebrowser/init.sls
new file mode 100644 (file)
index 0000000..13349ed
--- /dev/null
@@ -0,0 +1,62 @@
+include:
+  - qutebrowser.{{ grains['os'] | lower}}
+  - local.bin
+
+
+userscripts dir:
+  file.directory:
+    - name: {{ grains['homedir'] }}/.local/share/qutebrowser/userscripts
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}
+    - mode: 750
+    - makedirs: True
+    - require:
+      - pkg: install qutebrowser
+
+symlink qute-pass:
+  file.symlink:
+    - name: {{ grains['homedir'] }}/.local/share/qutebrowser/userscripts/qute-pass
+    - target: /usr/share/qutebrowser/userscripts/qute-pass
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}
+    - mode: 750
+    - require:
+      - file: userscripts dir
+
+noscript_enable file:
+  file.managed:
+    - name: {{ grains['homedir'] }}/.local/share/qutebrowser/userscripts/noscript_enable
+    - source: salt://qutebrowser/files/noscript_enable
+    - user: {{ grains['user'] }}
+    - groups: {{ grains['user'] }}
+    - mode: 750
+    - require:
+      - file: userscripts dir
+
+noscript_disable file:
+  file.managed:
+    - name: {{ grains['homedir'] }}/.local/share/qutebrowser/userscripts/noscript_disable
+    - source: salt://qutebrowser/files/noscript_disable
+    - user: {{ grains['user'] }}
+    - groups: {{ grains['user'] }}
+    - mode: 750
+    - require:
+      - file: userscripts dir
+
+qutebrowser wrapper:
+  file.managed:
+    - name: {{ grains['homedir'] }}/.local/bin/qutebrowser
+    - contents:
+      - #!/bin/sh
+      - /usr/bin/qutebrowser --qt-flag disable-reading-from-canvas $@
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}
+    - mode: 750
+
+qutebrowser config:
+  file.managed:
+    - name: {{ grains['homedir'] }}/.config/qutebrowser/config.py
+    - source: salt://qutebrowser/files/config.py
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}
+    - mode: 640