From 0c178db4a8b1b5cc0263d02f0634f4c2b702cfc0 Mon Sep 17 00:00:00 2001 From: larstvei Date: Sun, 24 Aug 2025 18:27:23 +0200 Subject: [PATCH] Customize keyboard with homerow mods and swapping alt/super --- home/desktop/hypr/default.nix | 1 + hosts/thinkpad/configuration.nix | 2 +- hosts/thinkpad/keyboard.nix | 37 ++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 hosts/thinkpad/keyboard.nix diff --git a/home/desktop/hypr/default.nix b/home/desktop/hypr/default.nix index ddd4f86..e862495 100644 --- a/home/desktop/hypr/default.nix +++ b/home/desktop/hypr/default.nix @@ -18,6 +18,7 @@ gestures.workspace_swipe = true; input = { + kb_options = "altwin:swap_alt_win"; natural_scroll = true; scroll_factor = 0.4; touchpad = { diff --git a/hosts/thinkpad/configuration.nix b/hosts/thinkpad/configuration.nix index 2acc250..17efb7d 100644 --- a/hosts/thinkpad/configuration.nix +++ b/hosts/thinkpad/configuration.nix @@ -1,5 +1,4 @@ { - config, pkgs, emacs-larstvei, zen-browser, @@ -12,6 +11,7 @@ in imports = [ ../../system ../../system/nixos + ./keyboard.nix ./hardware-configuration.nix ]; diff --git a/hosts/thinkpad/keyboard.nix b/hosts/thinkpad/keyboard.nix new file mode 100644 index 0000000..a92940f --- /dev/null +++ b/hosts/thinkpad/keyboard.nix @@ -0,0 +1,37 @@ +{ + services.kanata = { + enable = true; + keyboards = { + internalKeyboard = { + devices = [ + "/dev/input/by-path/platform-i8042-serio-0-event-kbd" + ]; + extraDefCfg = "process-unmapped-keys yes"; + config = '' + (defsrc + caps a s d f j k l ; + ) + (defvar + tap-time 150 + hold-time 200 + ) + (defalias + caps (tap-hold 100 100 esc lctl) + a (tap-hold $tap-time $hold-time a lsft) + s (tap-hold $tap-time $hold-time s lalt) + d (tap-hold $tap-time $hold-time d lmet) + f (tap-hold $tap-time $hold-time f lctl) + j (tap-hold $tap-time $hold-time j rctl) + k (tap-hold $tap-time $hold-time k rmet) + l (tap-hold $tap-time $hold-time l ralt) + ; (tap-hold $tap-time $hold-time ; rsft) + ) + + (deflayer base + @caps @a @s @d @f @j @k @l @; + ) + ''; + }; + }; + }; +}