From 5f6627e7e7affaffcac1abd211001ef26e442063 Mon Sep 17 00:00:00 2001
From: Marty Oehme <contact@martyoeh.me>
Date: Sun, 16 Mar 2025 10:01:14 +0100
Subject: [PATCH] qutebrowser: Add hypothesis annotation function

Can be activated through the command alias ':hypothesis' or just the
shortcut `<localleader>+a`, so `,a`.
---
 qutebrowser/config/alias.py | 3 +++
 qutebrowser/config/maps.py  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/qutebrowser/config/alias.py b/qutebrowser/config/alias.py
index 671718b..f87d6b1 100644
--- a/qutebrowser/config/alias.py
+++ b/qutebrowser/config/alias.py
@@ -40,3 +40,6 @@ c.aliases["cookie-block"] = "spawn --userscript qute-cookie-block"
 
 # open last downloads in dmenu-like
 c.aliases["recent-downloads"] = "spawn --userscript recently-downloaded"
+
+# annotate with hypothesis
+c.aliases["hypothesis"] = "jseval (function(){window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s)})();'hypothesis enabled'"
diff --git a/qutebrowser/config/maps.py b/qutebrowser/config/maps.py
index 648181b..ccc757a 100644
--- a/qutebrowser/config/maps.py
+++ b/qutebrowser/config/maps.py
@@ -86,6 +86,7 @@ config.bind('"p', "send-to-scihub", mode="normal")  # view current page doi on s
 config.bind(";p", "hint links run send-to-scihub")  # view linked doi on scihub
 
 config.bind(lleader + "r", "readable", mode="normal")
+config.bind(lleader + "a", "hypothesis", mode="normal")
 
 # set stylesheets for the browser to use
 config.bind(