Move DOI → Sci-Hub rewrite from Hammerspoon to Glide
Glide already rewrites URLs for reddit and x.com — DOI handling
belongs in the browser, not the OS-level URL dispatcher.
Assisted-by: Claude Opus 4.6 via Claude Code
diff --git a/.config/glide/glide.ts b/.config/glide/glide.ts
index 58ceb5db..558f006a 100644
--- a/.config/glide/glide.ts
+++ b/.config/glide/glide.ts
@@ -65,6 +65,11 @@ glide.autocmds.create("UrlEnter", { hostname: "x.com" }, async () => {
await browser.tabs.update({ url: url.toString() });
});
+// doi -> sci-hub
+glide.autocmds.create("UrlEnter", { hostname: "doi.org" }, async () => {
+ await browser.tabs.update({ url: `https://sci-hub.st/${glide.ctx.url}` });
+});
+
glide.styles.add(`
.yank-notification {
position: fixed;
diff --git a/.hammerspoon/handle-urls.fnl b/.hammerspoon/handle-urls.fnl
index 00221db6..bca99c28 100644
--- a/.hammerspoon/handle-urls.fnl
+++ b/.hammerspoon/handle-urls.fnl
@@ -30,8 +30,7 @@
;; fnlfmt: skip
(local default-handlers
- [["^https://.*%.?zoom.us/j/%d+" (open-with :zoom)]
- ["^https://doi.org/" #((open-with :default) (.. "https://sci-hub.st/" $1))]])
+ [["^https://.*%.?zoom.us/j/%d+" (open-with :zoom)]])
(fn url->handler [url]
(accumulate [acc nil _ [pat handler] (ipairs handlers) &until acc]