glide: Redirect www.reddit.com to old.reddit.com
New Reddit's redesign significantly degrades usability. The autocmd
intercepts www.reddit.com URLs and rewrites them to old.reddit.com
before navigation completes.

Also adds optional local.glide.ts support for machine-specific config
that shouldn't be synced across dotfiles.

Assisted-by: Claude Opus 4.5 (claude-code)
change kyrpxttlopmlmpwowpqlonymvwutlzvp
commit 0f25833e0d6b1f58f5f907967581c5fcf7c957b9
author Alpha Chen <alpha@kejadlen.dev>
date
parent uqpotxps
diff --git a/.config/glide/glide.ts b/.config/glide/glide.ts
index d3b7c97d..f68c5b30 100644
--- a/.config/glide/glide.ts
+++ b/.config/glide/glide.ts
@@ -18,16 +18,27 @@
 
 glide.unstable.include("hints.glide.ts");
 glide.unstable.include("tridactyl.glide.ts");
+glide.fs.exists("local.glide.ts").then(exists => {
+  if (exists) glide.unstable.include("local.glide.ts");
+});
 
 glide.g.mapleader = "," // too used to using space for scrolling
 glide.buf.keymaps.del("normal", "s"); // use `s` for searching
 
+// fix gmail keybindings
 glide.autocmds.create("UrlEnter", {hostname: "mail.google.com"}, async () => {
   glide.buf.keymaps.del("normal", "gi");
   glide.buf.keymaps.del("normal", "e");
   glide.buf.keymaps.del("normal", "o");
 });
 
+// new reddit is bad
+glide.autocmds.create("UrlEnter", {hostname: "www.reddit.com"}, async () => {
+  const url = new URL(glide.ctx.url);
+  url.hostname = "old.reddit.com";
+  await browser.tabs.update({ url: url.toString() });
+});
+
 glide.styles.add(`
   .yank-notification {
     position: fixed;