+ qutebrowser is a keyboard-focused browser with a minimal GUI.
+ It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl,
+ and is based on Python and PyQt5.
+
+
+
+ Network
+ WebBrowser
+
+
+ qutebrowser
+
+ qutebrowser.desktop
+
+
+ https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/main.png
+
+
+ https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/downloads.png
+
+
+ https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/completion.png
+
+
+ https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/hints.png
+
+
+ https://www.qutebrowser.org
+ https://qutebrowser.org/doc/faq.html
+ https://qutebrowser.org/doc/help/
+ https://github.com/qutebrowser/qutebrowser/issues/
+ https://github.com/qutebrowser/qutebrowser#donating
+
+
+
+
+
+
diff --git a/.config/qutebrowser/misc/qutebrowser.desktop b/.config/qutebrowser/misc/qutebrowser.desktop
new file mode 100644
index 0000000..5243b0c
--- /dev/null
+++ b/.config/qutebrowser/misc/qutebrowser.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=qutebrowser
+GenericName=Web Browser
+Comment=A keyboard-driven, vim-like browser based on PyQt5
+Icon=qutebrowser
+Type=Application
+Categories=Network;WebBrowser;
+Exec=qutebrowser %u
+Terminal=false
+StartupNotify=false
+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/qute;
+Keywords=Browser
diff --git a/.config/qutebrowser/misc/qutebrowser.nsi b/.config/qutebrowser/misc/qutebrowser.nsi
new file mode 100644
index 0000000..76f459a
--- /dev/null
+++ b/.config/qutebrowser/misc/qutebrowser.nsi
@@ -0,0 +1,80 @@
+Name "qutebrowser"
+
+Unicode true
+RequestExecutionLevel admin
+SetCompressor /solid lzma
+
+!ifdef X64
+ OutFile "..\dist\qutebrowser-${VERSION}-amd64.exe"
+ InstallDir "$ProgramFiles64\qutebrowser"
+!else
+ OutFile "..\dist\qutebrowser-${VERSION}-win32.exe"
+ InstallDir "$ProgramFiles\qutebrowser"
+!endif
+
+;Default installation folder
+
+!include "MUI2.nsh"
+;!include "MultiUser.nsh"
+
+!define MUI_ABORTWARNING
+;!define MULTIUSER_MUI
+;!define MULTIUSER_INSTALLMODE_COMMANDLINE
+!define MUI_ICON "../icons/qutebrowser.ico"
+!define MUI_UNICON "../icons/qutebrowser.ico"
+
+!insertmacro MUI_PAGE_LICENSE "..\LICENSE"
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+!insertmacro MUI_LANGUAGE "English"
+
+; depends on admin status
+;SetShellVarContext current
+
+
+Section "Install"
+
+ ; Uninstall old versions
+ ExecWait 'MsiExec.exe /quiet /qn /norestart /X{633F41F9-FE9B-42D1-9CC4-718CBD01EE11}'
+ ExecWait 'MsiExec.exe /quiet /qn /norestart /X{9331D947-AC86-4542-A755-A833429C6E69}'
+ IfFileExists "$INSTDIR\uninst.exe" 0 +2
+ ExecWait "$INSTDIR\uninst.exe /S _?=$INSTDIR"
+ CreateDirectory "$INSTDIR"
+
+ SetOutPath "$INSTDIR"
+
+ !ifdef X64
+ file /r "..\dist\qutebrowser-${VERSION}-x64\*.*"
+ !else
+ file /r "..\dist\qutebrowser-${VERSION}-x86\*.*"
+ !endif
+
+ SetShellVarContext all
+ CreateShortCut "$SMPROGRAMS\qutebrowser.lnk" "$INSTDIR\qutebrowser.exe"
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\uninst.exe"
+
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qutebrowser" "DisplayName" "qutebrowser"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qutebrowser" "UninstallString" '"$INSTDIR\uninst.exe"'
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qutebrowser" "QuietUninstallString" '"$INSTDIR\uninst.exe" /S'
+
+SectionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+
+ SetShellVarContext all
+ Delete "$SMPROGRAMS\qutebrowser.lnk"
+
+ RMDir /r "$INSTDIR\*.*"
+ RMDir "$INSTDIR"
+
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qutebrowser"
+
+SectionEnd
diff --git a/.config/qutebrowser/misc/qutebrowser.rcc b/.config/qutebrowser/misc/qutebrowser.rcc
new file mode 100644
index 0000000..2f73b37
--- /dev/null
+++ b/.config/qutebrowser/misc/qutebrowser.rcc
@@ -0,0 +1,13 @@
+
+
+ icons/qutebrowser-16x16.png
+ icons/qutebrowser-24x24.png
+ icons/qutebrowser-32x32.png
+ icons/qutebrowser-48x48.png
+ icons/qutebrowser-64x64.png
+ icons/qutebrowser-96x96.png
+ icons/qutebrowser-128x128.png
+ icons/qutebrowser-256x256.png
+ icons/qutebrowser-512x512.png
+
+
diff --git a/.config/qutebrowser/misc/qutebrowser.spec b/.config/qutebrowser/misc/qutebrowser.spec
new file mode 100644
index 0000000..c886fb0
--- /dev/null
+++ b/.config/qutebrowser/misc/qutebrowser.spec
@@ -0,0 +1,76 @@
+# -*- mode: python -*-
+
+import sys
+import os
+
+sys.path.insert(0, os.getcwd())
+from scripts import setupcommon
+
+block_cipher = None
+
+
+def get_data_files():
+ data_files = [
+ ('../qutebrowser/html', 'html'),
+ ('../qutebrowser/img', 'img'),
+ ('../qutebrowser/javascript', 'javascript'),
+ ('../qutebrowser/html/doc', 'html/doc'),
+ ('../qutebrowser/git-commit-id', '.'),
+ ('../qutebrowser/config/configdata.yml', 'config'),
+ ]
+
+ # if os.path.exists(os.path.join('qutebrowser', '3rdparty', 'pdfjs')):
+ # data_files.append(('../qutebrowser/3rdparty/pdfjs', '3rdparty/pdfjs'))
+ # else:
+ # print("Warning: excluding pdfjs as it's not present!")
+
+ return data_files
+
+
+setupcommon.write_git_file()
+
+
+if os.name == 'nt':
+ icon = 'icons/qutebrowser.ico'
+elif sys.platform == 'darwin':
+ icon = 'icons/qutebrowser.icns'
+else:
+ icon = None
+
+
+a = Analysis(['../qutebrowser/__main__.py'],
+ pathex=['misc'],
+ binaries=None,
+ datas=get_data_files(),
+ hiddenimports=['PyQt5.QtOpenGL', 'PyQt5._QOpenGLFunctions_2_0'],
+ hookspath=[],
+ runtime_hooks=[],
+ excludes=['tkinter'],
+ win_no_prefer_redirects=False,
+ win_private_assemblies=False,
+ cipher=block_cipher)
+pyz = PYZ(a.pure, a.zipped_data,
+ cipher=block_cipher)
+exe = EXE(pyz,
+ a.scripts,
+ exclude_binaries=True,
+ name='qutebrowser',
+ icon=icon,
+ debug=False,
+ strip=False,
+ upx=False,
+ console=False,
+ version='misc/file_version_info.txt')
+coll = COLLECT(exe,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ strip=False,
+ upx=False,
+ name='qutebrowser')
+
+app = BUNDLE(coll,
+ name='qutebrowser.app',
+ icon=icon,
+ # https://github.com/pyinstaller/pyinstaller/blob/b78bfe530cdc2904f65ce098bdf2de08c9037abb/PyInstaller/hooks/hook-PyQt5.QtWebEngineWidgets.py#L24
+ bundle_identifier='org.qt-project.Qt.QtWebEngineCore')
diff --git a/.config/qutebrowser/misc/requirements/README.md b/.config/qutebrowser/misc/requirements/README.md
new file mode 100644
index 0000000..6ae9862
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/README.md
@@ -0,0 +1,20 @@
+This directory contains various `requirements` files which are used by `tox` to
+have reproducible tests with pinned versions.
+
+The files are generated based on unpinned requirements in `*.txt-raw` files.
+
+Those files can also contain some special commands:
+
+- Add an additional comment to a line: `#@ comment: `
+- Filter a line for requirements.io: `#@ filter: `
+- Don't include a package in the output: `#@ ignore: ` (or multiple packages)
+- Replace a part of a frozen package specification with another: `#@ replace `
+
+Some examples:
+
+```
+#@ comment: mypkg blah blub
+#@ filter: mypkg != 1.0.0
+#@ ignore: mypkg, otherpkg
+#@ replace: foo bar
+```
diff --git a/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt b/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt
new file mode 100644
index 0000000..c11a3f7
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt
@@ -0,0 +1,3 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+check-manifest==0.37
diff --git a/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt-raw b/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt-raw
new file mode 100644
index 0000000..dcc0efe
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-check-manifest.txt-raw
@@ -0,0 +1 @@
+check-manifest
diff --git a/.config/qutebrowser/misc/requirements/requirements-codecov.txt b/.config/qutebrowser/misc/requirements/requirements-codecov.txt
new file mode 100644
index 0000000..9fed7b3
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-codecov.txt
@@ -0,0 +1,9 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+certifi==2018.4.16
+chardet==3.0.4
+codecov==2.0.15
+coverage==4.5.1
+idna==2.7
+requests==2.19.1
+urllib3==1.23
diff --git a/.config/qutebrowser/misc/requirements/requirements-codecov.txt-raw b/.config/qutebrowser/misc/requirements/requirements-codecov.txt-raw
new file mode 100644
index 0000000..15f1c72
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-codecov.txt-raw
@@ -0,0 +1 @@
+codecov
diff --git a/.config/qutebrowser/misc/requirements/requirements-flake8.txt b/.config/qutebrowser/misc/requirements/requirements-flake8.txt
new file mode 100644
index 0000000..b4f0045
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-flake8.txt
@@ -0,0 +1,27 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+attrs==18.1.0
+flake8==3.5.0
+flake8-bugbear==18.2.0
+flake8-builtins==1.4.1 # rq.filter: != 1.4.0
+flake8-comprehensions==1.4.1
+flake8-copyright==0.2.0
+flake8-debugger==3.1.0
+flake8-deprecated==1.3
+flake8-docstrings==1.3.0
+flake8-future-import==0.4.5
+flake8-mock==0.3
+flake8-per-file-ignores==0.6
+flake8-polyfill==1.0.2
+flake8-string-format==0.2.3
+flake8-tidy-imports==1.1.0
+flake8-tuple==0.2.13
+mccabe==0.6.1
+pathmatch==0.2.1
+pep8-naming==0.7.0
+pycodestyle==2.3.1 # rq.filter: < 2.4.0
+pydocstyle==2.1.1
+pyflakes==2.0.0
+six==1.11.0
+snowballstemmer==1.2.1
+typing==3.6.4
diff --git a/.config/qutebrowser/misc/requirements/requirements-flake8.txt-raw b/.config/qutebrowser/misc/requirements/requirements-flake8.txt-raw
new file mode 100644
index 0000000..7ccbbce
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-flake8.txt-raw
@@ -0,0 +1,23 @@
+flake8
+flake8-bugbear
+flake8-builtins!=1.4.0
+flake8-comprehensions
+flake8-copyright
+flake8-debugger
+flake8-deprecated
+flake8-docstrings
+flake8-future-import
+flake8-mock
+flake8-per-file-ignores
+flake8-string-format
+flake8-tidy-imports
+flake8-tuple
+pep8-naming
+pydocstyle
+pyflakes
+
+# https://github.com/PyCQA/pycodestyle/issues/741
+#@ filter: pycodestyle < 2.4.0
+
+# https://github.com/gforcada/flake8-builtins/issues/36
+#@ filter: flake8-builtins != 1.4.0
diff --git a/.config/qutebrowser/misc/requirements/requirements-pip.txt b/.config/qutebrowser/misc/requirements/requirements-pip.txt
new file mode 100644
index 0000000..bf003fc
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pip.txt
@@ -0,0 +1,8 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+appdirs==1.4.3
+packaging==17.1
+pyparsing==2.2.0
+setuptools==40.0.0
+six==1.11.0
+wheel==0.31.1
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt b/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt
new file mode 100644
index 0000000..e916393
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt
@@ -0,0 +1,7 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+altgraph==0.15
+future==0.16.0
+macholib==1.9
+pefile==2017.11.5
+PyInstaller==3.3.1
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt-raw b/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt-raw
new file mode 100644
index 0000000..c313980
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyinstaller.txt-raw
@@ -0,0 +1 @@
+PyInstaller
diff --git a/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt b/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt
new file mode 100644
index 0000000..2df0736
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt
@@ -0,0 +1,19 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+-e git+https://github.com/PyCQA/astroid.git#egg=astroid
+certifi==2018.4.16
+chardet==3.0.4
+github3.py==1.1.0
+idna==2.7
+isort==4.3.4
+lazy-object-proxy==1.3.1
+mccabe==0.6.1
+-e git+https://github.com/PyCQA/pylint.git#egg=pylint
+python-dateutil==2.7.3
+./scripts/dev/pylint_checkers
+requests==2.19.1
+six==1.11.0
+typed-ast==1.1.0
+uritemplate==3.0.0
+urllib3==1.23
+wrapt==1.10.11
diff --git a/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt-raw b/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt-raw
new file mode 100644
index 0000000..405b0ab
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pylint-master.txt-raw
@@ -0,0 +1,11 @@
+-e git+https://github.com/PyCQA/astroid.git#egg=astroid
+-e git+https://github.com/PyCQA/pylint.git#egg=pylint
+./scripts/dev/pylint_checkers
+requests
+github3.py
+
+# remove @commit-id for scm installs
+#@ replace: @.*# #
+
+# fix qute-pylint location
+#@ replace: qute-pylint==.* ./scripts/dev/pylint_checkers
diff --git a/.config/qutebrowser/misc/requirements/requirements-pylint.txt b/.config/qutebrowser/misc/requirements/requirements-pylint.txt
new file mode 100644
index 0000000..e78dfe2
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pylint.txt
@@ -0,0 +1,19 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+astroid==2.0.1
+certifi==2018.4.16
+chardet==3.0.4
+github3.py==1.1.0
+idna==2.7
+isort==4.3.4
+lazy-object-proxy==1.3.1
+mccabe==0.6.1
+pylint==2.0.1
+python-dateutil==2.7.3
+./scripts/dev/pylint_checkers
+requests==2.19.1
+six==1.11.0
+typed-ast==1.1.0
+uritemplate==3.0.0
+urllib3==1.23
+wrapt==1.10.11
diff --git a/.config/qutebrowser/misc/requirements/requirements-pylint.txt-raw b/.config/qutebrowser/misc/requirements/requirements-pylint.txt-raw
new file mode 100644
index 0000000..37252ee
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pylint.txt-raw
@@ -0,0 +1,7 @@
+pylint
+./scripts/dev/pylint_checkers
+requests
+github3.py
+
+# fix qute-pylint location
+#@ replace: qute-pylint==.* ./scripts/dev/pylint_checkers
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyqt.txt b/.config/qutebrowser/misc/requirements/requirements-pyqt.txt
new file mode 100644
index 0000000..2878a55
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyqt.txt
@@ -0,0 +1,4 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+PyQt5==5.11.2
+PyQt5-sip==4.19.12
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyqt.txt-raw b/.config/qutebrowser/misc/requirements/requirements-pyqt.txt-raw
new file mode 100644
index 0000000..37a69c4
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyqt.txt-raw
@@ -0,0 +1 @@
+PyQt5
\ No newline at end of file
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyroma.txt b/.config/qutebrowser/misc/requirements/requirements-pyroma.txt
new file mode 100644
index 0000000..6afd097
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyroma.txt
@@ -0,0 +1,4 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+docutils==0.14
+pyroma==2.3.1
diff --git a/.config/qutebrowser/misc/requirements/requirements-pyroma.txt-raw b/.config/qutebrowser/misc/requirements/requirements-pyroma.txt-raw
new file mode 100644
index 0000000..5ddfb65
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-pyroma.txt-raw
@@ -0,0 +1 @@
+pyroma
diff --git a/.config/qutebrowser/misc/requirements/requirements-qutebrowser.txt-raw b/.config/qutebrowser/misc/requirements/requirements-qutebrowser.txt-raw
new file mode 100644
index 0000000..c66c65b
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-qutebrowser.txt-raw
@@ -0,0 +1,7 @@
+Jinja2
+Pygments
+pyPEG2
+PyYAML
+colorama
+cssutils
+attrs
diff --git a/.config/qutebrowser/misc/requirements/requirements-tests-git.txt b/.config/qutebrowser/misc/requirements/requirements-tests-git.txt
new file mode 100644
index 0000000..ce00cd3
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-tests-git.txt
@@ -0,0 +1,38 @@
+bzr+lp:beautifulsoup
+git+https://github.com/cherrypy/cheroot.git
+hg+https://bitbucket.org/ned/coveragepy
+git+https://github.com/micheles/decorator.git
+git+https://github.com/pallets/flask.git
+git+https://github.com/miracle2k/python-glob2.git
+git+https://github.com/HypothesisWorks/hypothesis-python.git
+git+https://github.com/pallets/itsdangerous.git
+git+https://bitbucket.org/zzzeek/mako.git
+git+https://github.com/r1chardj0n3s/parse.git
+git+https://github.com/jenisys/parse_type.git
+hg+https://bitbucket.org/pytest-dev/py
+git+https://github.com/pytest-dev/pytest.git@features
+git+https://github.com/pytest-dev/pytest-bdd.git
+git+https://github.com/pytest-dev/pytest-cov.git
+git+https://github.com/pytest-dev/pytest-faulthandler.git
+git+https://github.com/pytest-dev/pytest-instafail.git
+git+https://github.com/pytest-dev/pytest-mock.git
+git+https://github.com/pytest-dev/pytest-qt.git
+git+https://github.com/pytest-dev/pytest-repeat.git
+git+https://github.com/pytest-dev/pytest-rerunfailures.git
+git+https://github.com/abusalimov/pytest-travis-fold.git
+git+https://github.com/The-Compiler/pytest-xvfb.git
+hg+https://bitbucket.org/gutworth/six
+hg+https://bitbucket.org/jendrikseipp/vulture
+git+https://github.com/pallets/werkzeug.git
+
+
+## qutebrowser dependencies
+
+git+https://github.com/tartley/colorama.git
+hg+https://bitbucket.org/cthedot/cssutils
+git+https://github.com/pallets/jinja.git
+git+https://github.com/pallets/markupsafe.git
+hg+http://bitbucket.org/birkenfeld/pygments-main
+hg+https://bitbucket.org/fdik/pypeg
+git+https://github.com/python-attrs/attrs.git
+git+https://github.com/yaml/pyyaml.git
diff --git a/.config/qutebrowser/misc/requirements/requirements-tests.txt b/.config/qutebrowser/misc/requirements/requirements-tests.txt
new file mode 100644
index 0000000..07b0378
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-tests.txt
@@ -0,0 +1,42 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+atomicwrites==1.1.5
+attrs==18.1.0
+backports.functools-lru-cache==1.5
+beautifulsoup4==4.6.0
+cheroot==6.3.3
+click==6.7
+# colorama==0.3.9
+coverage==4.5.1
+EasyProcess==0.2.3
+fields==5.0.0
+Flask==1.0.2
+glob2==0.6
+hunter==2.0.2
+hypothesis==3.66.6
+itsdangerous==0.24
+# Jinja2==2.10
+Mako==1.0.7
+# MarkupSafe==1.0
+more-itertools==4.2.0
+parse==1.8.4
+parse-type==0.4.2
+pluggy==0.6.0
+py==1.5.4
+py-cpuinfo==4.0.0
+pytest==3.6.3
+pytest-bdd==2.21.0
+pytest-benchmark==3.1.1
+pytest-cov==2.5.1
+pytest-faulthandler==1.5.0
+pytest-instafail==0.4.0
+pytest-mock==1.10.0
+pytest-qt==3.0.0
+pytest-repeat==0.5.0
+pytest-rerunfailures==4.1
+pytest-travis-fold==1.3.0
+pytest-xvfb==1.1.0
+PyVirtualDisplay==0.2.1
+six==1.11.0
+vulture==0.28
+Werkzeug==0.14.1
diff --git a/.config/qutebrowser/misc/requirements/requirements-tests.txt-raw b/.config/qutebrowser/misc/requirements/requirements-tests.txt-raw
new file mode 100644
index 0000000..1216899
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-tests.txt-raw
@@ -0,0 +1,21 @@
+beautifulsoup4
+cheroot
+coverage
+Flask
+hunter
+hypothesis
+pytest
+pytest-bdd
+pytest-benchmark
+pytest-cov
+pytest-faulthandler
+pytest-instafail
+pytest-mock
+pytest-qt
+pytest-repeat
+pytest-rerunfailures
+pytest-travis-fold
+pytest-xvfb
+vulture
+
+#@ ignore: Jinja2, MarkupSafe, colorama
diff --git a/.config/qutebrowser/misc/requirements/requirements-tox.txt b/.config/qutebrowser/misc/requirements/requirements-tox.txt
new file mode 100644
index 0000000..e8c660e
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-tox.txt
@@ -0,0 +1,9 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+packaging==17.1
+pluggy==0.6.0
+py==1.5.4
+pyparsing==2.2.0
+six==1.11.0
+tox==3.1.2
+virtualenv==16.0.0
diff --git a/.config/qutebrowser/misc/requirements/requirements-tox.txt-raw b/.config/qutebrowser/misc/requirements/requirements-tox.txt-raw
new file mode 100644
index 0000000..053148f
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-tox.txt-raw
@@ -0,0 +1 @@
+tox
diff --git a/.config/qutebrowser/misc/requirements/requirements-vulture.txt b/.config/qutebrowser/misc/requirements/requirements-vulture.txt
new file mode 100644
index 0000000..c8a26e8
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-vulture.txt
@@ -0,0 +1,3 @@
+# This file is automatically generated by scripts/dev/recompile_requirements.py
+
+vulture==0.28
diff --git a/.config/qutebrowser/misc/requirements/requirements-vulture.txt-raw b/.config/qutebrowser/misc/requirements/requirements-vulture.txt-raw
new file mode 100644
index 0000000..a10f860
--- /dev/null
+++ b/.config/qutebrowser/misc/requirements/requirements-vulture.txt-raw
@@ -0,0 +1 @@
+vulture
diff --git a/.config/qutebrowser/misc/userscripts/cast b/.config/qutebrowser/misc/userscripts/cast
new file mode 100755
index 0000000..f7b64df
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/cast
@@ -0,0 +1,156 @@
+#!/usr/bin/env bash
+#
+# Behaviour
+# Userscript for qutebrowser which casts the url passed in $1 to the default
+# ChromeCast device in the network using the program `castnow`
+#
+# Usage
+# You can launch the script from qutebrowser as follows:
+# spawn --userscript ${PATH_TO_FILE} {url}
+#
+# Then, you can control the chromecast by launching the simple command
+# `castnow` in a shell which will connect to the running castnow instance.
+#
+# For stopping the script, issue the command `pkill -f castnow` which would
+# then let the rest of the userscript execute for cleaning temporary file.
+#
+# Thanks
+# This userscript borrows Thorsten Wißmann's javascript code from his `mpv`
+# userscript.
+#
+# Dependencies
+# - castnow, https://github.com/xat/castnow
+#
+# Author
+# Simon Désaulniers
+
+if [ -z "$QUTE_FIFO" ] ; then
+ cat 1>&2 <&2
+ else
+ echo "message-$cmd '${msg//\'/\\\'}'" >> "$QUTE_FIFO"
+ fi
+}
+
+js() {
+cat <
+ The video is being cast on your ChromeCast device.
+
+
+ In order to restore this particular video
+ click here.
+
+ ";
+ replacement.style.position = "relative";
+ replacement.style.zIndex = "100003000000";
+ replacement.style.fontSize = "1rem";
+ replacement.style.textAlign = "center";
+ replacement.style.verticalAlign = "middle";
+ replacement.style.height = "100%";
+ replacement.style.background = "#101010";
+ replacement.style.color = "white";
+ replacement.style.border = "4px dashed #545454";
+ replacement.style.padding = "2em";
+ replacement.style.margin = "auto";
+ App.all_replacements[i] = replacement;
+ App.backup_videos[i] = video;
+ video.parentNode.replaceChild(replacement, video);
+ }
+
+ function restore_video(obj, index) {
+ obj = App.all_replacements[index];
+ video = App.backup_videos[index];
+ console.log(video);
+ obj.parentNode.replaceChild(video, obj);
+ }
+
+ /** force repainting the video, thanks to:
+ * http://martinwolf.org/2014/06/10/force-repaint-of-an-element-with-javascript/
+ */
+ var siteHeader = document.getElementById('header');
+ siteHeader.style.display='none';
+ siteHeader.offsetHeight; // no need to store this anywhere, the reference is enough
+ siteHeader.style.display='block';
+
+EOF
+}
+
+printjs() {
+ js | sed 's,//.*$,,' | tr '\n' ' '
+}
+echo "jseval -q $(printjs)" >> "$QUTE_FIFO"
+
+tmpdir=$(mktemp -d)
+file_to_cast=${tmpdir}/qutecast
+program_=$(command -v castnow)
+
+if [[ "${program_}" == "" ]]; then
+ msg error "castnow can't be found..."
+ exit 1
+fi
+
+# kill any running instance of castnow
+pkill -f "${program_}"
+
+# start youtube download in stream mode (-o -) into temporary file
+youtube-dl -qo - "$1" > "${file_to_cast}" &
+ytdl_pid=$!
+
+msg info "Casting $1" >> "$QUTE_FIFO"
+# start castnow in stream mode to cast on ChromeCast
+tail -F "${file_to_cast}" | ${program_} -
+
+# cleanup remaining background process and file on disk
+kill ${ytdl_pid}
+rm -rf "${tmpdir}"
diff --git a/.config/qutebrowser/misc/userscripts/dmenu_qutebrowser b/.config/qutebrowser/misc/userscripts/dmenu_qutebrowser
new file mode 100755
index 0000000..82e6d2f
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/dmenu_qutebrowser
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+# Copyright 2015 Zach-Button
+# Copyright 2015-2017 Florian Bruhin (The Compiler)
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+# Pipes history, quickmarks, and URL into dmenu.
+#
+# If run from qutebrowser as a userscript, it runs :open on the URL
+# If not, it opens a new qutebrowser window at the URL
+#
+# Ideal for use with tabs_are_windows. Set a hotkey to launch this script, then:
+# :bind o spawn --userscript dmenu_qutebrowser
+#
+# Use the hotkey to open in new tab/window, press 'o' to open URL in current tab/window
+# You can simulate "go" by pressing "o", as the current URL is always first in the list
+#
+# I personally use "o" to launch this script. For me, my workflow is:
+# Default keys Keys with this script
+# O o
+# o o
+# go o
+# gO gC, then o
+# (This is unnecessarily long. I use this rarely, feel free to make this script accept parameters.)
+#
+
+[ -z "$QUTE_URL" ] && QUTE_URL='http://google.com'
+
+url=$(echo "$QUTE_URL" | cat - "$QUTE_CONFIG_DIR/quickmarks" "$QUTE_DATA_DIR/history" | dmenu -l 15 -p qutebrowser)
+url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | grep -E "https?:" || echo "$url")
+
+[ -z "${url// }" ] && exit
+
+echo "open $url" >> "$QUTE_FIFO" || qutebrowser "$url"
diff --git a/.config/qutebrowser/misc/userscripts/format_json b/.config/qutebrowser/misc/userscripts/format_json
new file mode 100755
index 0000000..0d476b3
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/format_json
@@ -0,0 +1,42 @@
+#!/bin/sh
+set -euo pipefail
+#
+# Behavior:
+# Userscript for qutebrowser which will take the raw JSON text of the current
+# page, format it using `jq`, will add syntax highlighting using `pygments`,
+# and open the syntax highlighted pretty printed html in a new tab. If the file
+# is larger than 10MB then this script will only indent the json and will forego
+# syntax highlighting using pygments.
+#
+# In order to use this script, just start it using `spawn --userscript` from
+# qutebrowser. I recommend using an alias, e.g. put this in the
+# [alias]-section of qutebrowser.conf:
+#
+# json = spawn --userscript /path/to/json_format
+#
+# Note that the color style defaults to monokai, but a different pygments style
+# can be passed as the first parameter to the script. A full list of the pygments
+# styles can be found at: https://help.farbox.com/pygments.html
+#
+# Bryan Gilbert, 2017
+
+# do not run pygmentize on files larger than this amount of bytes
+MAX_SIZE_PRETTIFY=10485760 # 10 MB
+# default style to monokai if none is provided
+STYLE=${1:-monokai}
+
+TEMP_FILE="$(mktemp)"
+jq . "$QUTE_TEXT" >"$TEMP_FILE"
+
+# try GNU stat first and then OSX stat if the former fails
+FILE_SIZE=$(
+ stat --printf="%s" "$TEMP_FILE" 2>/dev/null ||
+ stat -f%z "$TEMP_FILE" 2>/dev/null
+)
+if [ "$FILE_SIZE" -lt "$MAX_SIZE_PRETTIFY" ]; then
+ pygmentize -l json -f html -O full,style="$STYLE" <"$TEMP_FILE" >"${TEMP_FILE}_"
+ mv -f "${TEMP_FILE}_" "$TEMP_FILE"
+fi
+
+# send the command to qutebrowser to open the new file containing the formatted json
+echo "open -t file://$TEMP_FILE" >> "$QUTE_FIFO"
diff --git a/.config/qutebrowser/misc/userscripts/getbib b/.config/qutebrowser/misc/userscripts/getbib
new file mode 100755
index 0000000..22af7a8
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/getbib
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+"""Qutebrowser userscript scraping the current web page for DOIs and downloading
+corresponding bibtex information.
+
+Set the environment variable 'QUTE_BIB_FILEPATH' to indicate the path to
+download to. Otherwise, bibtex information is downloaded to '/tmp' and hence
+deleted at reboot.
+
+Installation: see qute://help/userscripts.html
+
+Inspired by
+https://ocefpaf.github.io/python4oceanographers/blog/2014/05/19/doi2bibtex/
+"""
+
+import os
+import sys
+import shutil
+import re
+from collections import Counter
+from urllib import parse as url_parse
+from urllib import request as url_request
+
+
+FIFO_PATH = os.getenv("QUTE_FIFO")
+
+def message_fifo(message, level="warning"):
+ """Send message to qutebrowser FIFO. The level must be one of 'info',
+ 'warning' (default) or 'error'."""
+ with open(FIFO_PATH, "w") as fifo:
+ fifo.write("message-{} '{}'".format(level, message))
+
+
+source = os.getenv("QUTE_TEXT")
+with open(source) as f:
+ text = f.read()
+
+# find DOIs on page using regex
+dval = re.compile(r'(10\.(\d)+/([^(\s\>\"\<)])+)')
+# https://stackoverflow.com/a/10324802/3865876, too strict
+# dval = re.compile(r'\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b')
+dois = dval.findall(text)
+dois = Counter(e[0] for e in dois)
+try:
+ doi = dois.most_common(1)[0][0]
+except IndexError:
+ message_fifo("No DOIs found on page")
+ sys.exit()
+message_fifo("Found {} DOIs on page, selecting {}".format(len(dois), doi),
+ level="info")
+
+# get bibtex data corresponding to DOI
+url = "http://dx.doi.org/" + url_parse.quote(doi)
+headers = dict(Accept='text/bibliography; style=bibtex')
+request = url_request.Request(url, headers=headers)
+response = url_request.urlopen(request)
+status_code = response.getcode()
+if status_code >= 400:
+ message_fifo("Request returned {}".format(status_code))
+ sys.exit()
+
+# obtain content and format it
+bibtex = response.read().decode("utf-8").strip()
+bibtex = bibtex.replace(" ", "\n ", 1).\
+ replace("}, ", "},\n ").replace("}}", "}\n}")
+
+# append to file
+bib_filepath = os.getenv("QUTE_BIB_FILEPATH", "/tmp/qute.bib")
+with open(bib_filepath, "a") as f:
+ f.write(bibtex + "\n\n")
diff --git a/.config/qutebrowser/misc/userscripts/open_download b/.config/qutebrowser/misc/userscripts/open_download
new file mode 100755
index 0000000..8dbb113
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/open_download
@@ -0,0 +1,115 @@
+#!/usr/bin/env bash
+# Both standalone script and qutebrowser userscript that opens a rofi menu with
+# all files from the download director and opens the selected file. It works
+# both as a userscript and a standalone script that is called from outside of
+# qutebrowser.
+#
+# Suggested keybinding (for "show downloads"):
+# spawn --userscript ~/.config/qutebrowser/open_download
+# sd
+#
+# Requirements:
+# - rofi (in a recent version)
+# - xdg-open and xdg-mime
+# - You should configure qutebrowser to download files to a single directory
+# - It comes in handy if you enable downloads.remove_finished. If you want to
+# see the recent downloads, just press "sd".
+#
+# Thorsten Wißmann, 2015 (thorsten` on freenode)
+# Any feedback is welcome!
+
+set -e
+
+# open a file from the download directory using rofi
+DOWNLOAD_DIR=${DOWNLOAD_DIR:-$QUTE_DOWNLOAD_DIR}
+DOWNLOAD_DIR=${DOWNLOAD_DIR:-$HOME/Downloads}
+# the name of the rofi command
+ROFI_CMD=${ROFI_CMD:-rofi}
+ROFI_ARGS=${ROFI_ARGS:-}
+
+msg() {
+ local cmd="$1"
+ shift
+ local msg="$*"
+ if [ -z "$QUTE_FIFO" ] ; then
+ echo "$cmd: $msg" >&2
+ else
+ echo "message-$cmd '${msg//\'/\\\'}'" >> "$QUTE_FIFO"
+ fi
+}
+die() {
+ msg error "$*"
+ if [ -n "$QUTE_FIFO" ] ; then
+ # when run as a userscript, the above error message already informs the
+ # user about the failure, and no additional "userscript exited with status
+ # 1" is needed.
+ exit 0;
+ else
+ exit 1;
+ fi
+}
+
+if ! [ -d "$DOWNLOAD_DIR" ] ; then
+ die "Download directory »$DOWNLOAD_DIR« not found!"
+fi
+if ! command -v "${ROFI_CMD}" > /dev/null ; then
+ die "Rofi command »${ROFI_CMD}« not found in PATH!"
+fi
+
+rofi_default_args=(
+ -monitor -2 # place above window
+ -location 6 # aligned at the bottom
+ -width 100 # use full window width
+ -i
+ -no-custom
+ -format i # make rofi return the index
+ -l 10
+ -p 'Open download:' -dmenu
+ )
+
+crop-first-column() {
+ local maxlength=${1:-40}
+ local expression='s|^\([^\t]\{0,'"$maxlength"'\}\)[^\t]*\t|\1\t|'
+ sed "$expression"
+}
+
+ls-files() {
+ # add the slash at the end of the download dir enforces to follow the
+ # symlink, if the DOWNLOAD_DIR itself is a symlink
+ # shellcheck disable=SC2010
+ ls -Q --quoting-style escape -h -o -1 -A -t "${DOWNLOAD_DIR}/" \
+ | grep '^[-]' \
+ | cut -d' ' -f3- \
+ | sed 's,^\(.*[^\]\) \(.*\)$,\2\t\1,' \
+ | sed 's,\\\(.\),\1,g'
+}
+
+mapfile -t entries < <(ls-files)
+
+# we need to manually check that there are items, because rofi doesn't show up
+# if there are no items and -no-custom is passed to rofi.
+if [ "${#entries[@]}" -eq 0 ] ; then
+ die "Download directory »${DOWNLOAD_DIR}« empty"
+fi
+
+line=$(printf '%s\n' "${entries[@]}" \
+ | crop-first-column 55 \
+ | column -s $'\t' -t \
+ | $ROFI_CMD "${rofi_default_args[@]}" "$ROFI_ARGS") || true
+if [ -z "$line" ]; then
+ exit 0
+fi
+
+file="${entries[$line]}"
+file="${file%%$'\t'*}"
+path="$DOWNLOAD_DIR/$file"
+filetype=$(xdg-mime query filetype "$path")
+application=$(xdg-mime query default "$filetype")
+
+if [ -z "$application" ] ; then
+ die "Do not know how to open »$file« of type $filetype"
+fi
+
+msg info "Opening »$file« (of type $filetype) with ${application%.desktop}"
+
+xdg-open "$path" &
diff --git a/.config/qutebrowser/misc/userscripts/openfeeds b/.config/qutebrowser/misc/userscripts/openfeeds
new file mode 100755
index 0000000..4a1a942
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/openfeeds
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2015 jnphilipp
+# Copyright 2016-2017 Florian Bruhin (The Compiler)
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+# Opens all links to feeds defined in the head of a site
+#
+# Ideal for use with tabs_are_windows. Set a hotkey to launch this script, then:
+# :bind gF spawn --userscript openfeeds
+#
+# Use the hotkey to open the feeds in new tab/window, press 'gF' to open
+#
+
+import os
+import re
+
+from bs4 import BeautifulSoup
+from urllib.parse import urljoin
+
+with open(os.environ['QUTE_HTML'], 'r') as f:
+ soup = BeautifulSoup(f)
+with open(os.environ['QUTE_FIFO'], 'w') as f:
+ for link in soup.find_all('link', rel='alternate', type=re.compile(r'application/((rss|rdf|atom)\+)?xml|text/xml')):
+ f.write('open -t %s\n' % urljoin(os.environ['QUTE_URL'], link.get('href')))
diff --git a/.config/qutebrowser/misc/userscripts/password_fill b/.config/qutebrowser/misc/userscripts/password_fill
new file mode 100755
index 0000000..a61a42c
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/password_fill
@@ -0,0 +1,381 @@
+#!/usr/bin/env bash
+help() {
+ blink=$'\e[1;31m' reset=$'\e[0m'
+cat <
+In case of questions or suggestions, do not hesitate to send me an E-Mail or to
+directly ask me via IRC (nickname thorsten\`) in #qutebrowser on freenode.
+
+ $blink!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$reset
+ WARNING: the passwords are stored in qutebrowser's
+ debug log reachable via the url qute://log
+ $blink!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$reset
+
+Usage: run as a userscript form qutebrowser, e.g.:
+ spawn --userscript ~/.config/qutebrowser/password_fill
+
+Pass backend: (see also passwordstore.org)
+ This script expects pass to store the credentials of each page in an extra
+ file, where the filename (or filepath) contains the domain of the respective
+ page. The first line of the file must contain the password, the login name
+ must be contained in a later line beginning with "user:", "login:", or
+ "username:" (configurable by the user_pattern variable).
+
+Behavior:
+ It will try to find a username/password entry in the configured backend
+ (currently only pass) for the current website and will load that pair of
+ username and password to any form on the current page that has some password
+ entry field. If multiple entries are found, a zenity menu is offered.
+
+ If no entry is found, then it crops subdomains from the url if at least one
+ entry is found in the backend. (In that case, it always shows a menu)
+
+Configuration:
+ This script loads the bash script ~/.config/qutebrowser/password_fill_rc (if
+ it exists), so you can change any configuration variable and overwrite any
+ function you like.
+
+EOF
+}
+
+set -o errexit
+set -o pipefail
+shopt -s nocasematch # make regexp matching in bash case insensitive
+
+if [ -z "$QUTE_FIFO" ] ; then
+ help
+ exit
+fi
+
+error() {
+ local msg="$*"
+ echo "message-error '${msg//\'/\\\'}'" >> "$QUTE_FIFO"
+}
+msg() {
+ local msg="$*"
+ echo "message-info '${msg//\'/\\\'}'" >> "$QUTE_FIFO"
+}
+die() {
+ error "$*"
+ exit 0
+}
+
+javascript_escape() {
+ # print the first argument in an escaped way, such that it can safely
+ # be used within javascripts double quotes
+ sed "s,[\\\\'\"],\\\\&,g" <<< "$1"
+}
+
+# ======================================================= #
+# CONFIGURATION
+# ======================================================= #
+# The configuration file is per default located in
+# ~/.config/qutebrowser/password_fill_rc and is a bash script that is loaded
+# later in the present script. So basically you can replace all of the
+# following definitions and make them fit your needs.
+
+# The following simplifies a URL to the domain (e.g. "wiki.qutebrowser.org")
+# which is later used to search the correct entries in the password backend. If
+# you e.g. don't want the "www." to be removed or if you want to distinguish
+# between different paths on the same domain.
+
+simplify_url() {
+ simple_url="${1##*://}" # remove protocol specification
+ simple_url="${simple_url%%\?*}" # remove GET parameters
+ simple_url="${simple_url%%/*}" # remove directory path
+ simple_url="${simple_url%:*}" # remove port
+ simple_url="${simple_url##www.}" # remove www. subdomain
+}
+
+# no_entries_found() is called if the first query_entries() call did not find
+# any matching entries. Multiple implementations are possible:
+# The easiest behavior is to quit:
+#no_entries_found() {
+# if [ 0 -eq "${#files[@]}" ] ; then
+# die "No entry found for »$simple_url«"
+# fi
+#}
+# But you could also fill the files array with all entries from your pass db
+# if the first db query did not find anything
+# no_entries_found() {
+# if [ 0 -eq "${#files[@]}" ] ; then
+# query_entries ""
+# if [ 0 -eq "${#files[@]}" ] ; then
+# die "No entry found for »$simple_url«"
+# fi
+# fi
+# }
+
+# Another behavior is to drop another level of subdomains until search hits
+# are found:
+no_entries_found() {
+ while [ 0 -eq "${#files[@]}" ] && [ -n "$simple_url" ]; do
+ shorter_simple_url=$(sed 's,^[^.]*\.,,' <<< "$simple_url")
+ if [ "$shorter_simple_url" = "$simple_url" ] ; then
+ # if no dot, then even remove the top level domain
+ simple_url=""
+ query_entries "$simple_url"
+ break
+ fi
+ simple_url="$shorter_simple_url"
+ query_entries "$simple_url"
+ #die "No entry found for »$simple_url«"
+ # enforce menu if we do "fuzzy" matching
+ menu_if_one_entry=1
+ done
+ if [ 0 -eq "${#files[@]}" ] ; then
+ die "No entry found for »$simple_url«"
+ fi
+}
+
+# Backend implementations tell, how the actual password store is accessed.
+# Right now, there is only one fully functional password backend, namely for
+# the program "pass".
+# A password backend consists of three actions:
+# - init() initializes backend-specific things and does sanity checks.
+# - query_entries() is called with a simplified url and is expected to fill
+# the bash array $files with the names of matching password entries. There
+# are no requirements how these names should look like.
+# - open_entry() is called with some specific entry of the $files array and is
+# expected to write the username of that entry to the $username variable and
+# the corresponding password to $password
+
+reset_backend() {
+ init() { true ; }
+ query_entries() { true ; }
+ open_entry() { true ; }
+}
+
+# choose_entry() is expected to choose one entry from the array $files and
+# write it to the variable $file.
+choose_entry() {
+ choose_entry_zenity
+}
+
+# The default implementation chooses a random entry from the array. So if there
+# are multiple matching entries, multiple calls to this userscript will
+# eventually pick the "correct" entry. I.e. if this userscript is bound to
+# "zl", the user has to press "zl" until the correct username shows up in the
+# login form.
+choose_entry_random() {
+ local nr=${#files[@]}
+ file="${files[$((RANDOM % nr))]}"
+ # Warn user, that there might be other matching password entries
+ if [ "$nr" -gt 1 ] ; then
+ msg "Picked $file out of $nr entries: ${files[*]}"
+ fi
+}
+
+# another implementation would be to ask the user via some menu (like rofi or
+# dmenu or zenity or even qutebrowser completion in future?) which entry to
+# pick
+MENU_COMMAND=( head -n 1 )
+# whether to show the menu if there is only one entry in it
+menu_if_one_entry=0
+choose_entry_menu() {
+ local nr=${#files[@]}
+ if [ "$nr" -eq 1 ] && ! ((menu_if_one_entry)) ; then
+ file="${files[0]}"
+ else
+ file=$( printf '%s\n' "${files[@]}" | "${MENU_COMMAND[@]}" )
+ fi
+}
+
+choose_entry_rofi() {
+ MENU_COMMAND=( rofi -p "qutebrowser> " -dmenu
+ -mesg $'Pick a password entry for '"${QUTE_URL//&/&}"'' )
+ choose_entry_menu || true
+}
+
+choose_entry_zenity() {
+ MENU_COMMAND=( zenity --list --title "qutebrowser password fill"
+ --text "Pick the password entry:"
+ --column "Name" )
+ choose_entry_menu || true
+}
+
+choose_entry_zenity_radio() {
+ zenity_helper() {
+ awk '{ print $0 ; print $0 }' \
+ | zenity --list --radiolist \
+ --title "qutebrowser password fill" \
+ --text "Pick the password entry:" \
+ --column " " --column "Name"
+ }
+ MENU_COMMAND=( zenity_helper )
+ choose_entry_menu || true
+}
+
+# =======================================================
+# backend: PASS
+
+# configuration options:
+match_filename=1 # whether allowing entry match by filepath
+match_line=0 # whether allowing entry match by URL-Pattern in file
+ # Note: match_line=1 gets very slow, even for small password stores!
+match_line_pattern='^url: .*' # applied using grep -iE
+user_pattern='^(user|username|login): '
+
+GPG_OPTS=( "--quiet" "--yes" "--compress-algo=none" "--no-encrypt-to" )
+GPG="gpg"
+export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}"
+command -v gpg2 &>/dev/null && GPG="gpg2"
+[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )
+
+pass_backend() {
+ init() {
+ PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ if ! [ -d "$PREFIX" ] ; then
+ die "Can not open password store dir »$PREFIX«"
+ fi
+ }
+ query_entries() {
+ local url="$1"
+
+ if ((match_line)) ; then
+ # add entries with matching URL-tag
+ while read -r -d "" passfile ; do
+ if $GPG "${GPG_OPTS[@]}" -d "$passfile" \
+ | grep --max-count=1 -iE "${match_line_pattern}${url}" > /dev/null
+ then
+ passfile="${passfile#$PREFIX}"
+ passfile="${passfile#/}"
+ files+=( "${passfile%.gpg}" )
+ fi
+ done < <(find -L "$PREFIX" -iname '*.gpg' -print0)
+ fi
+ if ((match_filename)) ; then
+ # add entries with matching filepath
+ while read -r passfile ; do
+ passfile="${passfile#$PREFIX}"
+ passfile="${passfile#/}"
+ files+=( "${passfile%.gpg}" )
+ done < <(find -L "$PREFIX" -iname '*.gpg' | grep "$url")
+ fi
+ }
+ open_entry() {
+ local path="$PREFIX/${1}.gpg"
+ password=""
+ local firstline=1
+ while read -r line ; do
+ if ((firstline)) ; then
+ password="$line"
+ firstline=0
+ else
+ if [[ $line =~ $user_pattern ]] ; then
+ # remove the matching prefix "user: " from the beginning of the line
+ username=${line#${BASH_REMATCH[0]}}
+ break
+ fi
+ fi
+ done < <($GPG "${GPG_OPTS[@]}" -d "$path" )
+ }
+}
+# =======================================================
+
+# =======================================================
+# backend: secret
+secret_backend() {
+ init() {
+ return
+ }
+ query_entries() {
+ local domain="$1"
+ while read -r line ; do
+ if [[ "$line" == "attribute.username = "* ]] ; then
+ files+=("$domain ${line:21}")
+ fi
+ done < <( secret-tool search --unlock --all domain "$domain" 2>&1 )
+ }
+ open_entry() {
+ local domain="${1%% *}"
+ username="${1#* }"
+ password=$(secret-tool lookup domain "$domain" username "$username")
+ }
+}
+# =======================================================
+
+# load some sane default backend
+reset_backend
+pass_backend
+# load configuration
+QUTE_CONFIG_DIR=${QUTE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/qutebrowser/}
+PWFILL_CONFIG=${PWFILL_CONFIG:-${QUTE_CONFIG_DIR}/password_fill_rc}
+if [ -f "$PWFILL_CONFIG" ] ; then
+ # shellcheck source=/dev/null
+ source "$PWFILL_CONFIG"
+fi
+init
+
+simplify_url "$QUTE_URL"
+query_entries "${simple_url}"
+no_entries_found
+# remove duplicates
+mapfile -t files < <(printf '%s\n' "${files[@]}" | sort | uniq )
+choose_entry
+if [ -z "$file" ] ; then
+ # choose_entry didn't want any of these entries
+ exit 0
+fi
+open_entry "$file"
+#username="$(date)"
+#password="XYZ"
+#msg "$username, ${#password}"
+
+[ -n "$username" ] || die "Username not set in entry $file"
+[ -n "$password" ] || die "Password not set in entry $file"
+
+js() {
+cat < 0 && elem.offsetHeight > 0;
+ };
+ function hasPasswordField(form) {
+ var inputs = form.getElementsByTagName("input");
+ for (var j = 0; j < inputs.length; j++) {
+ var input = inputs[j];
+ if (input.type == "password") {
+ return true;
+ }
+ }
+ return false;
+ };
+ function loadData2Form (form) {
+ var inputs = form.getElementsByTagName("input");
+ for (var j = 0; j < inputs.length; j++) {
+ var input = inputs[j];
+ if (isVisible(input) && (input.type == "text" || input.type == "email")) {
+ input.focus();
+ input.value = "$(javascript_escape "${username}")";
+ input.blur();
+ }
+ if (input.type == "password") {
+ input.focus();
+ input.value = "$(javascript_escape "${password}")";
+ input.blur();
+ }
+ }
+ };
+
+ var forms = document.getElementsByTagName("form");
+ for (i = 0; i < forms.length; i++) {
+ if (hasPasswordField(forms[i])) {
+ loadData2Form(forms[i]);
+ }
+ }
+EOF
+}
+
+printjs() {
+ js | sed 's,//.*$,,' | tr '\n' ' '
+}
+echo "jseval -q $(printjs)" >> "$QUTE_FIFO"
diff --git a/.config/qutebrowser/misc/userscripts/qute-keepass b/.config/qutebrowser/misc/userscripts/qute-keepass
new file mode 100755
index 0000000..a21ebc9
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/qute-keepass
@@ -0,0 +1,261 @@
+#!/usr/bin/env python3
+
+# Copyright 2018 Jay Kamat
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+"""This userscript allows for insertion of usernames and passwords from keepass
+databases using pykeepass. Since it is a userscript, it must be run from
+qutebrowser.
+
+A sample invocation of this script is:
+
+:spawn --userscript qute-keepass -p ~/KeePassFiles/MainDatabase.kdbx
+
+And a sample binding
+
+:bind --mode=insert spawn --userscript qute-keepass -p ~/KeePassFiles/MainDatabase.kdbx
+
+-p or --path is a required argument.
+
+--keyfile-path allows you to specify a keepass keyfile. If you only use a
+keyfile, also add --no-password as well. Specifying --no-password without
+--keyfile-path will lead to an error.
+
+login information is inserted using :insert-text and :fake-key , which
+means you must have a cursor in position before initiating this userscript. If
+you do not do this, you will get 'element not editable' errors.
+
+If keepass takes a while to open the DB, you might want to consider reducing
+the number of transform rounds in your database settings.
+
+Dependencies: pykeepass (in python3), PyQt5. Without pykeepass, you will get an
+exit code of 100.
+
+********************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!******************
+
+WARNING: The login details are viewable as plaintext in qutebrowser's debug log
+(qute://log) and could be compromised if you decide to submit a crash report!
+
+********************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!******************
+
+"""
+
+# pylint: disable=bad-builtin
+
+import argparse
+import enum
+import functools
+import os
+import shlex
+import subprocess
+import sys
+
+from PyQt5.QtCore import QUrl
+from PyQt5.QtWidgets import QApplication, QInputDialog, QLineEdit
+
+try:
+ import pykeepass
+except ImportError as e:
+ print("pykeepass not found: {}".format(str(e)), file=sys.stderr)
+
+ # Since this is a common error, try to print it to the FIFO if we can.
+ if 'QUTE_FIFO' in os.environ:
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write('message-error "pykeepass failed to be imported."\n')
+ fifo.flush()
+ sys.exit(100)
+
+argument_parser = argparse.ArgumentParser(
+ description="Fill passwords using keepass.",
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ epilog=__doc__)
+argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
+argument_parser.add_argument('--path', '-p', required=True,
+ help='Path to the keepass db.')
+argument_parser.add_argument('--keyfile-path', '-k', default=None,
+ help='Path to a keepass keyfile')
+argument_parser.add_argument(
+ '--no-password', action='store_true',
+ help='Supply if no password is required to unlock this database. '
+ 'Only allowed with --keyfile-path')
+argument_parser.add_argument(
+ '--dmenu-invocation', '-d', default='dmenu',
+ help='Invocation used to execute a dmenu-provider')
+argument_parser.add_argument(
+ '--dmenu-format', '-f', default='{title}: {username}',
+ help='Format string for keys to display in dmenu.'
+ ' Must generate a unique string.')
+argument_parser.add_argument(
+ '--no-insert-mode', '-n', dest='insert_mode', action='store_false',
+ help="Don't automatically enter insert mode")
+argument_parser.add_argument(
+ '--io-encoding', '-i', default='UTF-8',
+ help='Encoding used to communicate with subprocesses')
+group = argument_parser.add_mutually_exclusive_group()
+group.add_argument('--username-fill-only', '-e',
+ action='store_true', help='Only insert username')
+group.add_argument('--password-fill-only', '-w',
+ action='store_true', help='Only insert password')
+
+CMD_DELAY = 50
+
+
+class ExitCodes(enum.IntEnum):
+ """Stores various exit codes groups to use."""
+ SUCCESS = 0
+ FAILURE = 1
+ # 1 is automatically used if Python throws an exception
+ NO_CANDIDATES = 2
+ USER_QUIT = 3
+ DB_OPEN_FAIL = 4
+
+ INTERNAL_ERROR = 10
+
+
+def qute_command(command):
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write(command + '\n')
+ fifo.flush()
+
+
+def stderr(to_print):
+ """Extra functionality to echo out errors to qb ui."""
+ print(to_print, file=sys.stderr)
+ qute_command('message-error "{}"'.format(to_print))
+
+
+def dmenu(items, invocation, encoding):
+ """Runs dmenu with given arguments."""
+ command = shlex.split(invocation)
+ process = subprocess.run(command, input='\n'.join(items).encode(encoding),
+ stdout=subprocess.PIPE)
+ return process.stdout.decode(encoding).strip()
+
+
+def get_password():
+ """Get a keepass db password from user."""
+ _app = QApplication(sys.argv)
+ text, ok = QInputDialog.getText(
+ None, "KeePass DB Password",
+ "Please enter your KeePass Master Password",
+ QLineEdit.Password)
+ if not ok:
+ stderr('Password Prompt Rejected.')
+ sys.exit(ExitCodes.USER_QUIT)
+ return text
+
+
+def find_candidates(args, host):
+ """Finds candidates that match host"""
+ file_path = os.path.expanduser(args.path)
+
+ # TODO find a way to keep the db open, so we don't open (and query
+ # password) it every time
+
+ pw = None
+ if not args.no_password:
+ pw = get_password()
+
+ kf = args.keyfile_path
+ if kf:
+ kf = os.path.expanduser(kf)
+
+ try:
+ kp = pykeepass.PyKeePass(file_path, password=pw, keyfile=kf)
+ except Exception as e:
+ stderr("There was an error opening the DB: {}".format(str(e)))
+
+ return kp.find_entries(url="{}{}{}".format(".*", host, ".*"), regex=True)
+
+
+def candidate_to_str(args, candidate):
+ """Turns candidate into a human readable string for dmenu"""
+ return args.dmenu_format.format(title=candidate.title,
+ url=candidate.url,
+ username=candidate.username,
+ path=candidate.path,
+ uuid=candidate.uuid)
+
+
+def candidate_to_secret(candidate):
+ """Turns candidate into a generic (user, password) tuple"""
+ return (candidate.username, candidate.password)
+
+
+def run(args):
+ """Runs qute-keepass"""
+ if not args.url:
+ argument_parser.print_help()
+ return ExitCodes.FAILURE
+
+ url_host = QUrl(args.url).host()
+
+ if not url_host:
+ stderr('{} was not parsed as a valid URL!'.format(args.url))
+ return ExitCodes.INTERNAL_ERROR
+
+ # Find candidates matching the host of the given URL
+ candidates = find_candidates(args, url_host)
+ if not candidates:
+ stderr('No candidates for URL {!r} found!'.format(args.url))
+ return ExitCodes.NO_CANDIDATES
+
+ # Create a map so we can get turn the resulting string from dmenu back into
+ # a candidate
+ candidates_strs = list(map(functools.partial(candidate_to_str, args),
+ candidates))
+ candidates_map = dict(zip(candidates_strs, candidates))
+
+ if len(candidates) == 1:
+ selection = candidates.pop()
+ else:
+ selection = dmenu(candidates_strs,
+ args.dmenu_invocation,
+ args.io_encoding)
+
+ if selection not in candidates_map:
+ stderr("'{}' was not a valid entry!").format(selection)
+ return ExitCodes.USER_QUIT
+
+ selection = candidates_map[selection]
+
+ username, password = candidate_to_secret(selection)
+
+ insert_mode = ';; enter-mode insert' if args.insert_mode else ''
+ if args.username_fill_only:
+ qute_command('insert-text {}{}'.format(username, insert_mode))
+ elif args.password_fill_only:
+ qute_command('insert-text {}{}'.format(password, insert_mode))
+ else:
+ # Enter username and password using insert-key and fake-key
+ # (which supports more passwords than fake-key only), then switch back
+ # into insert-mode, so the form can be directly submitted by hitting
+ # enter afterwards. It dosen't matter when we go into insert mode, but
+ # the other commands need to be be executed sequentially, so we add
+ # delays with later.
+ qute_command('insert-text {} ;;'
+ 'later {} fake-key ;;'
+ 'later {} insert-text {}{}'
+ .format(username, CMD_DELAY,
+ CMD_DELAY * 2, password, insert_mode))
+
+ return ExitCodes.SUCCESS
+
+
+if __name__ == '__main__':
+ arguments = argument_parser.parse_args()
+ sys.exit(run(arguments))
diff --git a/.config/qutebrowser/misc/userscripts/qute-lastpass b/.config/qutebrowser/misc/userscripts/qute-lastpass
new file mode 100755
index 0000000..ea88cf8
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/qute-lastpass
@@ -0,0 +1,172 @@
+#!/usr/bin/env python3
+
+# Copyright 2017 Chris Braun (cryzed)
+# Adapted for LastPass by Wayne Cheng (welps)
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published bjy
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+"""
+Insert login information using lastpass CLI and a dmenu-compatible application (e.g. dmenu, rofi -dmenu, ...).
+A short demonstration can be seen here: https://i.imgur.com/zA61NrF.gifv.
+"""
+
+USAGE = """The domain of the site has to be in the name of the LastPass entry, for example: "github.com/cryzed" or
+"websites/github.com". The login information is inserted by emulating key events using qutebrowser's fake-key command in this manner:
+[USERNAME][PASSWORD], which is compatible with almost all login forms.
+
+You must log into LastPass CLI using `lpass login ` prior to use of this script. The LastPass CLI agent only holds your master password for an hour by default. If you wish to change this, please see `man lpass`.
+
+To use in qutebrowser, run: `spawn --userscript qute-lastpass`
+"""
+
+EPILOG = """Dependencies: tldextract (Python 3 module), LastPass CLI (1.3 or newer)
+
+WARNING: The login details are viewable as plaintext in qutebrowser's debug log (qute://log) and might be shared if
+you decide to submit a crash report!"""
+
+import argparse
+import enum
+import fnmatch
+import functools
+import os
+import re
+import shlex
+import subprocess
+import sys
+import json
+import tldextract
+
+argument_parser = argparse.ArgumentParser(
+ description=__doc__, usage=USAGE, epilog=EPILOG)
+argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
+argument_parser.add_argument('--dmenu-invocation', '-d', default='rofi -dmenu',
+ help='Invocation used to execute a dmenu-provider')
+argument_parser.add_argument('--no-insert-mode', '-n', dest='insert_mode', action='store_false',
+ help="Don't automatically enter insert mode")
+argument_parser.add_argument('--io-encoding', '-i', default='UTF-8',
+ help='Encoding used to communicate with subprocesses')
+argument_parser.add_argument('--merge-candidates', '-m', action='store_true',
+ help='Merge pass candidates for fully-qualified and registered domain name')
+group = argument_parser.add_mutually_exclusive_group()
+group.add_argument('--username-only', '-e',
+ action='store_true', help='Only insert username')
+group.add_argument('--password-only', '-w',
+ action='store_true', help='Only insert password')
+
+stderr = functools.partial(print, file=sys.stderr)
+
+class ExitCodes(enum.IntEnum):
+ SUCCESS = 0
+ FAILURE = 1
+ # 1 is automatically used if Python throws an exception
+ NO_PASS_CANDIDATES = 2
+ COULD_NOT_MATCH_USERNAME = 3
+ COULD_NOT_MATCH_PASSWORD = 4
+
+def qute_command(command):
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write(command + '\n')
+ fifo.flush()
+
+def pass_(domain, encoding):
+ args = ['lpass', 'show', '-x', '-j', '-G', '.*{:s}.*'.format(domain)]
+ process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ err = process.stderr.decode(encoding).strip()
+ if err:
+ msg = "LastPass CLI returned for {:s} - {:s}".format(domain, err)
+ stderr(msg)
+ return '[]'
+
+ out = process.stdout.decode(encoding).strip()
+
+ return out
+
+def dmenu(items, invocation, encoding):
+ command = shlex.split(invocation)
+ process = subprocess.run(command, input='\n'.join(
+ items).encode(encoding), stdout=subprocess.PIPE)
+ return process.stdout.decode(encoding).strip()
+
+
+def fake_key_raw(text):
+ for character in text:
+ # Escape all characters by default, space requires special handling
+ sequence = '" "' if character == ' ' else '\{}'.format(character)
+ qute_command('fake-key {}'.format(sequence))
+
+
+def main(arguments):
+ if not arguments.url:
+ argument_parser.print_help()
+ return ExitCodes.FAILURE
+
+ extract_result = tldextract.extract(arguments.url)
+
+ # Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
+ # the registered domain name and finally: the IPv4 address if that's what
+ # the URL represents
+ candidates = []
+ for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.subdomain + extract_result.domain, extract_result.domain, extract_result.ipv4]):
+ target_candidates = json.loads(pass_(target, arguments.io_encoding))
+ if not target_candidates:
+ continue
+
+ candidates = candidates + target_candidates
+ if not arguments.merge_candidates:
+ break
+ else:
+ if not candidates:
+ stderr('No pass candidates for URL {!r} found!'.format(
+ arguments.url))
+ return ExitCodes.NO_PASS_CANDIDATES
+
+ if len(candidates) == 1:
+ selection = candidates.pop()
+ else:
+ choices = ["{:s} | {:s} | {:s} | {:s}".format(c["id"], c["name"], c["url"], c["username"]) for c in candidates]
+ choice = dmenu(choices, arguments.dmenu_invocation, arguments.io_encoding)
+ choiceId = choice.split("|")[0].strip()
+ selection = next((c for (i, c) in enumerate(candidates) if c["id"] == choiceId), None)
+
+ # Nothing was selected, simply return
+ if not selection:
+ return ExitCodes.SUCCESS
+
+ username = selection["username"]
+ password = selection["password"]
+
+ if arguments.username_only:
+ fake_key_raw(username)
+ elif arguments.password_only:
+ fake_key_raw(password)
+ else:
+ # Enter username and password using fake-key and (which seems to work almost universally), then switch
+ # back into insert-mode, so the form can be directly submitted by
+ # hitting enter afterwards
+ fake_key_raw(username)
+ qute_command('fake-key ')
+ fake_key_raw(password)
+
+ if arguments.insert_mode:
+ qute_command('enter-mode insert')
+
+ return ExitCodes.SUCCESS
+
+
+if __name__ == '__main__':
+ arguments = argument_parser.parse_args()
+ sys.exit(main(arguments))
diff --git a/.config/qutebrowser/misc/userscripts/qute-pass b/.config/qutebrowser/misc/userscripts/qute-pass
new file mode 100755
index 0000000..4f79e11
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/qute-pass
@@ -0,0 +1,207 @@
+#!/usr/bin/env python3
+
+# Copyright 2017 Chris Braun (cryzed)
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+"""
+Insert login information using pass and a dmenu-compatible application (e.g. dmenu, rofi -dmenu, ...). A short
+demonstration can be seen here: https://i.imgur.com/KN3XuZP.gif.
+"""
+
+USAGE = """The domain of the site has to appear as a segment in the pass path, for example: "github.com/cryzed" or
+"websites/github.com". How the username and password are determined is freely configurable using the CLI arguments. The
+login information is inserted by emulating key events using qutebrowser's fake-key command in this manner:
+[USERNAME][PASSWORD], which is compatible with almost all login forms.
+
+Suggested bindings similar to Uzbl's `formfiller` script:
+
+ config.bind('', 'spawn --userscript qute-pass')
+ config.bind('', 'spawn --userscript qute-pass --username-only')
+ config.bind('
', 'spawn --userscript qute-pass --password-only')
+ config.bind('', 'spawn --userscript qute-pass --otp-only')
+"""
+
+EPILOG = """Dependencies: tldextract (Python 3 module), pass, pass-otp (optional).
+For issues and feedback please use: https://github.com/cryzed/qutebrowser-userscripts.
+
+WARNING: The login details are viewable as plaintext in qutebrowser's debug log (qute://log) and might be shared if
+you decide to submit a crash report!"""
+
+import argparse
+import enum
+import fnmatch
+import functools
+import os
+import re
+import shlex
+import subprocess
+import sys
+
+import tldextract
+
+argument_parser = argparse.ArgumentParser(description=__doc__, usage=USAGE, epilog=EPILOG)
+argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
+argument_parser.add_argument('--password-store', '-p', default=os.path.expanduser('~/.password-store'),
+ help='Path to your pass password-store')
+argument_parser.add_argument('--username-pattern', '-u', default=r'.*/(.+)',
+ help='Regular expression that matches the username')
+argument_parser.add_argument('--username-target', '-U', choices=['path', 'secret'], default='path',
+ help='The target for the username regular expression')
+argument_parser.add_argument('--password-pattern', '-P', default=r'(.*)',
+ help='Regular expression that matches the password')
+argument_parser.add_argument('--dmenu-invocation', '-d', default='rofi -dmenu',
+ help='Invocation used to execute a dmenu-provider')
+argument_parser.add_argument('--no-insert-mode', '-n', dest='insert_mode', action='store_false',
+ help="Don't automatically enter insert mode")
+argument_parser.add_argument('--io-encoding', '-i', default='UTF-8',
+ help='Encoding used to communicate with subprocesses')
+argument_parser.add_argument('--merge-candidates', '-m', action='store_true',
+ help='Merge pass candidates for fully-qualified and registered domain name')
+group = argument_parser.add_mutually_exclusive_group()
+group.add_argument('--username-only', '-e', action='store_true', help='Only insert username')
+group.add_argument('--password-only', '-w', action='store_true', help='Only insert password')
+group.add_argument('--otp-only', '-o', action='store_true', help='Only insert OTP code')
+
+stderr = functools.partial(print, file=sys.stderr)
+
+
+class ExitCodes(enum.IntEnum):
+ SUCCESS = 0
+ FAILURE = 1
+ # 1 is automatically used if Python throws an exception
+ NO_PASS_CANDIDATES = 2
+ COULD_NOT_MATCH_USERNAME = 3
+ COULD_NOT_MATCH_PASSWORD = 4
+
+
+def qute_command(command):
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write(command + '\n')
+ fifo.flush()
+
+
+def find_pass_candidates(domain, password_store_path):
+ candidates = []
+ for path, directories, file_names in os.walk(password_store_path, followlinks=True):
+ if directories or domain not in path.split(os.path.sep):
+ continue
+
+ # Strip password store path prefix to get the relative pass path
+ pass_path = path[len(password_store_path) + 1:]
+ secrets = fnmatch.filter(file_names, '*.gpg')
+ candidates.extend(os.path.join(pass_path, os.path.splitext(secret)[0]) for secret in secrets)
+ return candidates
+
+
+def _run_pass(command, encoding):
+ process = subprocess.run(command, stdout=subprocess.PIPE)
+ return process.stdout.decode(encoding).strip()
+
+
+def pass_(path, encoding):
+ return _run_pass(['pass', path], encoding)
+
+
+def pass_otp(path, encoding):
+ return _run_pass(['pass', 'otp', path], encoding)
+
+
+def dmenu(items, invocation, encoding):
+ command = shlex.split(invocation)
+ process = subprocess.run(command, input='\n'.join(items).encode(encoding), stdout=subprocess.PIPE)
+ return process.stdout.decode(encoding).strip()
+
+
+def fake_key_raw(text):
+ for character in text:
+ # Escape all characters by default, space requires special handling
+ sequence = '" "' if character == ' ' else '\{}'.format(character)
+ qute_command('fake-key {}'.format(sequence))
+
+
+def main(arguments):
+ if not arguments.url:
+ argument_parser.print_help()
+ return ExitCodes.FAILURE
+
+ extract_result = tldextract.extract(arguments.url)
+
+ # Expand potential ~ in paths, since this script won't be called from a shell that does it for us
+ password_store_path = os.path.expanduser(arguments.password_store)
+
+ # Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
+ # the registered domain name and finally: the IPv4 address if that's what the URL represents
+ candidates = set()
+ for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.ipv4]):
+ target_candidates = find_pass_candidates(target, password_store_path)
+ if not target_candidates:
+ continue
+
+ candidates.update(target_candidates)
+ if not arguments.merge_candidates:
+ break
+ else:
+ if not candidates:
+ stderr('No pass candidates for URL {!r} found!'.format(arguments.url))
+ return ExitCodes.NO_PASS_CANDIDATES
+
+ selection = candidates.pop() if len(candidates) == 1 else dmenu(sorted(candidates), arguments.dmenu_invocation,
+ arguments.io_encoding)
+ # Nothing was selected, simply return
+ if not selection:
+ return ExitCodes.SUCCESS
+
+ secret = pass_(selection, arguments.io_encoding)
+
+ # Match username
+ target = selection if arguments.username_target == 'path' else secret
+ match = re.match(arguments.username_pattern, target)
+ if not match:
+ stderr('Failed to match username pattern on {}!'.format(arguments.username_target))
+ return ExitCodes.COULD_NOT_MATCH_USERNAME
+ username = match.group(1)
+
+ # Match password
+ match = re.match(arguments.password_pattern, secret)
+ if not match:
+ stderr('Failed to match password pattern on secret!')
+ return ExitCodes.COULD_NOT_MATCH_PASSWORD
+ password = match.group(1)
+
+ if arguments.username_only:
+ fake_key_raw(username)
+ elif arguments.password_only:
+ fake_key_raw(password)
+ elif arguments.otp_only:
+ otp = pass_otp(selection, arguments.io_encoding)
+ fake_key_raw(otp)
+ else:
+ # Enter username and password using fake-key and (which seems to work almost universally), then switch
+ # back into insert-mode, so the form can be directly submitted by hitting enter afterwards
+ fake_key_raw(username)
+ qute_command('fake-key ')
+ fake_key_raw(password)
+
+ if arguments.insert_mode:
+ qute_command('enter-mode insert')
+
+ return ExitCodes.SUCCESS
+
+
+if __name__ == '__main__':
+ arguments = argument_parser.parse_args()
+ sys.exit(main(arguments))
diff --git a/.config/qutebrowser/misc/userscripts/qutedmenu b/.config/qutebrowser/misc/userscripts/qutedmenu
new file mode 100755
index 0000000..de1b8d6
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/qutedmenu
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Handle open -s && open -t with bemenu
+
+#:bind o spawn --userscript /path/to/userscripts/qutedmenu open
+#:bind O spawn --userscript /path/to/userscripts/qutedmenu tab
+
+# If you would like to set a custom colorscheme/font use these dirs.
+# https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/bemenucolors
+readonly confdir=${XDG_CONFIG_HOME:-$HOME/.config}
+
+readonly optsfile=$confdir/dmenu/bemenucolors
+
+create_menu() {
+ # Check quickmarks
+ while read -r url; do
+ printf -- '%s\n' "$url"
+ done < "$QUTE_CONFIG_DIR"/quickmarks
+
+ # Next bookmarks
+ while read -r url _; do
+ printf -- '%s\n' "$url"
+ done < "$QUTE_CONFIG_DIR"/bookmarks/urls
+
+ # Finally history
+ while read -r _ url; do
+ printf -- '%s\n' "$url"
+ done < "$QUTE_DATA_DIR"/history
+ }
+
+get_selection() {
+ opts+=(-p qutebrowser)
+ #create_menu | dmenu -l 10 "${opts[@]}"
+ create_menu | bemenu -l 10 "${opts[@]}"
+}
+
+# Main
+# https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/font
+[[ -s $confdir/dmenu/font ]] && read -r font < "$confdir"/dmenu/font
+
+[[ $font ]] && opts+=(-fn "$font")
+
+# shellcheck source=/dev/null
+[[ -s $optsfile ]] && source "$optsfile"
+
+url=$(get_selection)
+url=${url/*http/http}
+
+# If no selection is made, exit (escape pressed, e.g.)
+[[ ! $url ]] && exit 0
+
+case $1 in
+ open) printf '%s' "open $url" >> "$QUTE_FIFO" || qutebrowser "$url" ;;
+ tab) printf '%s' "open -t $url" >> "$QUTE_FIFO" || qutebrowser "$url" ;;
+esac
diff --git a/.config/qutebrowser/misc/userscripts/readability b/.config/qutebrowser/misc/userscripts/readability
new file mode 100755
index 0000000..d0ef437
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/readability
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# Executes python-readability on current page and opens the summary as new tab.
+#
+# Depends on the python-readability package, or its fork:
+#
+# - https://github.com/buriy/python-readability
+# - https://github.com/bookieio/breadability
+#
+# Usage:
+# :spawn --userscript readability
+#
+from __future__ import absolute_import
+import codecs, os
+
+tmpfile = os.path.join(
+ os.environ.get('QUTE_DATA_DIR',
+ os.path.expanduser('~/.local/share/qutebrowser')),
+ 'userscripts/readability.html')
+
+if not os.path.exists(os.path.dirname(tmpfile)):
+ os.makedirs(os.path.dirname(tmpfile))
+
+with codecs.open(os.environ['QUTE_HTML'], 'r', 'utf-8') as source:
+ data = source.read()
+
+ try:
+ from breadability.readable import Article as reader
+ doc = reader(data)
+ content = doc.readable
+ except ImportError:
+ from readability import Document
+ doc = Document(data)
+ content = doc.summary().replace('', '%s' % doc.title())
+
+ with codecs.open(tmpfile, 'w', 'utf-8') as target:
+ target.write('')
+ target.write(content)
+
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write('open -t %s' % tmpfile)
diff --git a/.config/qutebrowser/misc/userscripts/ripbang b/.config/qutebrowser/misc/userscripts/ripbang
new file mode 100755
index 0000000..b35ff77
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/ripbang
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+#
+# Adds DuckDuckGo bang as searchengine.
+#
+# Usage:
+# :spawn --userscript ripbang [bang]...
+#
+# Example:
+# :spawn --userscript ripbang amazon maps
+#
+
+from __future__ import print_function
+import os, re, requests, sys
+
+try:
+ from urllib.parse import unquote
+except ImportError:
+ from urllib import unquote
+
+for argument in sys.argv[1:]:
+ bang = '!' + argument
+ r = requests.get('https://duckduckgo.com/',
+ params={'q': bang + ' SEARCHTEXT'})
+
+ searchengine = unquote(re.search("url=[^']+", r.text).group(0))
+ searchengine = searchengine.replace('url=', '')
+ searchengine = searchengine.replace('/l/?kh=-1&uddg=', '')
+ searchengine = searchengine.replace('SEARCHTEXT', '{}')
+
+ if os.getenv('QUTE_FIFO'):
+ with open(os.environ['QUTE_FIFO'], 'w') as fifo:
+ fifo.write('set searchengines %s %s' % (bang, searchengine))
+ else:
+ print('%s %s' % (bang, searchengine))
diff --git a/.config/qutebrowser/misc/userscripts/rss b/.config/qutebrowser/misc/userscripts/rss
new file mode 100755
index 0000000..f8feebe
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/rss
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+# Copyright 2016 Jan Verbeek (blyxxyz)
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+# This script keeps track of URLs in RSS feeds and opens new ones.
+# New feeds can be added with ':spawn -u /path/to/userscripts/rss add' or
+# ':spawn -u /path/to/userscripts/rss '.
+# New items can be opened with ':spawn -u /path/to/userscripts/rss'.
+# The script doesn't really parse XML, and searches for things that look like
+# item links. It might open things that aren't real links, and it might miss
+# real links.
+
+config_dir="$HOME/.qute-rss"
+
+add_feed () {
+ touch "feeds"
+ if grep -Fq "$1" "feeds"; then
+ notice "$1 is saved already."
+ else
+ printf '%s\n' "$1" >> "feeds"
+ fi
+}
+
+# Show an error message and exit
+fail () {
+ echo "message-error '$*'" > "$QUTE_FIFO"
+ exit 1
+}
+
+# Get a sorted list of item URLs from a RSS feed
+get_items () {
+ $curl "$@" | grep "$text_only" -zo -e ']*>[^<>]*' \
+ -e ']*>[^<>]*' \
+ -e ']*href="[^"]*"' |
+ grep "$text_only" -o 'http[^<>"]*' | sort | uniq
+}
+
+# Show an info message
+notice () {
+ echo "message-info '$*'" > "$QUTE_FIFO"
+}
+
+# Update a database of a feed and open new URLs
+read_items () {
+ cd read_urls || return 1
+ feed_file="$(echo "$1" | tr -d /)"
+ feed_temp_file="$(mktemp "$feed_file.tmp.XXXXXXXXXX")"
+ feed_new_items="$(mktemp "$feed_file.new.XXXXXXXXXX")"
+ get_items "$1" > "$feed_temp_file"
+ if [ ! -s "$feed_temp_file" ]; then
+ notice "No items found for $1."
+ rm "$feed_temp_file" "$feed_new_items"
+ elif [ ! -f "$feed_file" ]; then
+ notice "$1 is a new feed. All items will be marked as read."
+ mv "$feed_temp_file" "$feed_file"
+ rm "$feed_new_items"
+ else
+ sort -o "$feed_file" "$feed_file"
+ comm -2 -3 "$feed_temp_file" "$feed_file" | tee "$feed_new_items"
+ cat "$feed_new_items" >> "$feed_file"
+ sort -o "$feed_file" "$feed_file"
+ rm "$feed_temp_file" "$feed_new_items"
+ fi | while read -r item; do
+ echo "open -t $item" > "$QUTE_FIFO"
+ done
+}
+
+if [ ! -d "$config_dir/read_urls" ]; then
+ notice "Creating configuration directory."
+ mkdir -p "$config_dir/read_urls"
+fi
+
+cd "$config_dir" || exit 1
+
+if [ $# != 0 ]; then
+ for arg in "$@"; do
+ if [ "$arg" = "add" ]; then
+ add_feed "$QUTE_URL"
+ else
+ add_feed "$arg"
+ fi
+ done
+ exit
+fi
+
+if [ ! -f "feeds" ]; then
+ fail "Add feeds by running ':spawn -u rss add' or ':spawn -u rss '."
+fi
+
+if curl --version >&-; then
+ curl="curl -sL"
+elif wget --version >&-; then
+ curl="wget -qO -"
+else
+ fail "Either curl or wget is needed to run this script."
+fi
+
+# Detect GNU grep so we can force it to treat everything as text
+if < /dev/null grep --help 2>&1 | grep -q -- -a; then
+ text_only="-a"
+fi
+
+while read -r feed_url; do
+ read_items "$feed_url" &
+done < "$config_dir/feeds"
+
+wait
diff --git a/.config/qutebrowser/misc/userscripts/taskadd b/.config/qutebrowser/misc/userscripts/taskadd
new file mode 100755
index 0000000..36e1c2c
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/taskadd
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# Behavior:
+# Userscript for qutebrowser which adds a task to taskwarrior.
+# If run as a command (:spawn --userscript taskadd), it creates a new task
+# with the description equal to the current page title and annotates it with
+# the current page url. Additional arguments are passed along so you can add
+# mods to the task (e.g. priority, due date, tags).
+#
+# Example:
+# :spawn --userscript taskadd due:eod pri:H
+#
+# To enable passing along extra args, I suggest using a mapping like:
+# :bind set-cmd-text -s :spawn --userscript taskadd
+#
+# If run from hint mode, it uses the selected hint text as the description
+# and the selected hint url as the annotation.
+#
+# Ryan Roden-Corrent (rcorre), 2016
+# Any feedback is welcome!
+#
+# For more info on Taskwarrior, see http://taskwarrior.org/
+
+# use either the current page title or the hint text as the task description
+[[ $QUTE_MODE == 'hints' ]] && title=$QUTE_SELECTED_TEXT || title=$QUTE_TITLE
+
+# try to add the task and grab the output
+if msg="$(task add "$title" "$*" 2>&1)"; then
+ # annotate the new task with the url, send the output back to the browser
+ task +LATEST annotate "$QUTE_URL"
+ echo "message-info '$(echo "$msg" | head -n 1)'" >> "$QUTE_FIFO"
+else
+ echo "message-error '$(echo "$msg" | head -n 1)'" >> "$QUTE_FIFO"
+fi
diff --git a/.config/qutebrowser/misc/userscripts/tor_identity b/.config/qutebrowser/misc/userscripts/tor_identity
new file mode 100755
index 0000000..93b6d41
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/tor_identity
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2018 jnphilipp
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see .
+
+# Change your tor identity.
+#
+# Set a hotkey to launch this script, then:
+# :bind ti spawn --userscript tor_identity PASSWORD
+#
+# Use the hotkey to change your tor identity, press 'ti' to change it.
+# https://stem.torproject.org/faq.html#how-do-i-request-a-new-identity-from-tor
+#
+
+import os
+import sys
+
+try:
+ from stem import Signal
+ from stem.control import Controller
+except ImportError:
+ if os.getenv('QUTE_FIFO'):
+ with open(os.environ['QUTE_FIFO'], 'w') as f:
+ f.write('message-error "Failed to import stem."')
+ else:
+ print('Failed to import stem.')
+
+
+password = sys.argv[1]
+with Controller.from_port(port=9051) as controller:
+ controller.authenticate(password)
+ controller.signal(Signal.NEWNYM)
+ if os.getenv('QUTE_FIFO'):
+ with open(os.environ['QUTE_FIFO'], 'w') as f:
+ f.write('message-info "Tor identity changed."')
+ else:
+ print('Tor identity changed.')
diff --git a/.config/qutebrowser/misc/userscripts/view_in_mpv b/.config/qutebrowser/misc/userscripts/view_in_mpv
new file mode 100755
index 0000000..16603bd
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/view_in_mpv
@@ -0,0 +1,143 @@
+#!/usr/bin/env bash
+#
+# Behavior:
+# Userscript for qutebrowser which views the current web page in mpv using
+# sensible mpv-flags. While viewing the page in MPV, all
+
+ In order to restore this particular video
+ click here.
+
+ ";
+ replacement.style.position = "relative";
+ replacement.style.zIndex = "100003000000";
+ replacement.style.fontSize = "1rem";
+ replacement.style.textAlign = "center";
+ replacement.style.verticalAlign = "middle";
+ replacement.style.height = "100%";
+ replacement.style.background = "#101010";
+ replacement.style.color = "white";
+ replacement.style.border = "4px dashed #545454";
+ replacement.style.padding = "2em";
+ replacement.style.margin = "auto";
+ App.all_replacements[i] = replacement;
+ App.backup_videos[i] = video;
+ video.parentNode.replaceChild(replacement, video);
+ }
+
+ function restore_video(obj, index) {
+ obj = App.all_replacements[index];
+ video = App.backup_videos[index];
+ console.log(video);
+ obj.parentNode.replaceChild(video, obj);
+ }
+
+ /** force repainting the video, thanks to:
+ * http://martinwolf.org/2014/06/10/force-repaint-of-an-element-with-javascript/
+ */
+ var siteHeader = document.getElementById('header');
+ siteHeader.style.display='none';
+ siteHeader.offsetHeight; // no need to store this anywhere, the reference is enough
+ siteHeader.style.display='block';
+
+EOF
+}
+
+printjs() {
+ js | sed 's,//.*$,,' | tr '\n' ' '
+}
+echo "jseval -q $(printjs)" >> "$QUTE_FIFO"
+
+msg info "Opening $QUTE_URL with mpv"
+"${video_command[@]}" "$@" "$QUTE_URL"
--
cgit v1.2.3