From ced418a65b9ec194ee9b08c04b9fd5873d93a2a5 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Wed, 31 Jan 2024 02:59:03 +0100
Subject: [PATCH] Add more Slambda chords & disable Wezterm keybind

In particular, `alt+enter` is a keybind in `catgirl` which I couldn't access
because of the default `wezterm`  keybinds
---
 home/features/desktop/wezterm/wezterm.lua     | 21 ++++++-------
 .../common/optional/services/slambda.nix      | 30 ++++++++++++-------
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/home/features/desktop/wezterm/wezterm.lua b/home/features/desktop/wezterm/wezterm.lua
index 829bdce..fbdb8ec 100644
--- a/home/features/desktop/wezterm/wezterm.lua
+++ b/home/features/desktop/wezterm/wezterm.lua
@@ -76,18 +76,19 @@ config.enable_csi_u_key_encoding = true -- For some reason I need this for all k
 -- }}}
 -- }}}
 -- {{{ Keybinds
+local function unmap(key, mods)
+  return {
+    key = key,
+    mods = mods,
+    action = wezterm.action.DisableDefaultAssignment,
+  }
+end
+
 config.keys = {
   -- {{{ Disable certain default keybinds
-  {
-    key = "f",
-    mods = "CTRL|SHIFT",
-    action = wezterm.action.DisableDefaultAssignment,
-  },
-  {
-    key = "w",
-    mods = "CTRL|SHIFT",
-    action = wezterm.action.DisableDefaultAssignment,
-  },
+  unmap("f", "CTRL|SHIFT"),
+  unmap("w", "CTRL|SHIFT"),
+  unmap("Enter", "ALT"),
   -- }}}
 }
 -- }}}
diff --git a/hosts/nixos/common/optional/services/slambda.nix b/hosts/nixos/common/optional/services/slambda.nix
index ea74df7..7e242a0 100644
--- a/hosts/nixos/common/optional/services/slambda.nix
+++ b/hosts/nixos/common/optional/services/slambda.nix
@@ -1,25 +1,35 @@
 let
   chord = from: to: { inherit from to; };
   unmap = from: chord from [ ];
+  # I want my brackets to be aligned
+  sem = "semicolon";
   commonChords = [
     # {{{ Modifiers
-    (chord [ "s" "d" ] [ "leftshift" ])
-    (chord [ "s" "f" ] [ "leftctrl" ])
-    (chord [ "s" "a" ] [ "leftalt" ])
-    (chord [ "l" "k" ] [ "rightshift" ])
-    (chord [ "l" "j" ] [ "rightctrl" ])
-    (chord [ "l" "semicolon" ] [ "rightalt" ])
+    # {{{ right
     (chord [ "l" "n" ] [ "rightmeta" ])
+    (chord [ "k" "l" ] [ "rightshift" ])
+    (chord [ "j" "l" ] [ "rightctrl" ])
+    (chord [ "l" sem ] [ "rightalt" ])
     (chord [ "j" "k" "l" ] [ "rightctrl" "rightshift" ])
-    (chord [ "s" "d" "f" ] [ "leftctrl" "leftshift" ])
-    (unmap [ "leftalt" ])
-    # (unmap [ "leftshift" ]) # Useful for touhou
-    (unmap [ "leftctrl" ])
+    (chord [ "k" "l" sem ] [ "rightalt" "rightshift" ])
+    (chord [ "j" "k" "l" sem ] [ "rightalt" "rightctrl" "rightshift" ])
     (unmap [ "rightshift" ])
     (unmap [ "rightctrl" ])
     (unmap [ "rightalt" ])
     (unmap [ "rightmeta" ])
     # }}}
+    # {{{ left
+    (chord [ "s" "d" ] [ "leftshift" ])
+    (chord [ "s" "f" ] [ "leftctrl" ])
+    (chord [ "s" "a" ] [ "leftalt" ])
+    (chord [ "s" "d" "f" ] [ "leftctrl" "leftshift" ])
+    (chord [ "a" "s" "d" ] [ "leftalt" "leftshift" ])
+    (chord [ "a" "s" "d" "f" ] [ "leftalt" "leftctrl" "leftshift" ])
+    (unmap [ "leftalt" ])
+    (unmap [ "leftctrl" ])
+    # (unmap [ "leftshift" ]) # Useful for touhou
+    # }}}
+    # }}}
     # {{{ Other special keys
     (chord [ "g" "h" ] [ "backspace" ])
     (chord [ "n" "v" ] [ "backslash" ])