dotfiles/modules/nixos/hardware/keyboard.nix
Noah Masur 842f373101
switch from keyd to kanata
more reliable, doesn't break on update. also allows the escape key to
timeout and turn into lctrl after 1 second, which might be nicer
behavior
2024-08-07 23:24:28 -04:00

43 lines
1.0 KiB
Nix

{ config, lib, ... }:
{
config = lib.mkIf config.physical {
services.xserver = {
xkb.layout = "us";
# Keyboard responsiveness
autoRepeatDelay = 250;
autoRepeatInterval = 40;
};
# Swap Caps-Lock with Escape when pressed or LCtrl when held/combined with others
# Inspired by: https://www.youtube.com/watch?v=XuQVbZ0wENE
services.kanata = {
enable = true;
keyboards.default = {
devices = [
"/dev/input/by-id/usb-Logitech_Logitech_G710_Keyboard-event-kbd"
"/dev/input/by-id/usb-Logitech_Logitech_G710_Keyboard-if01-event-kbd"
];
extraDefCfg = "process-unmapped-keys yes";
config = ''
(defsrc
caps
)
(defalias
escctrl (tap-hold-press 1000 1000 esc lctrl)
)
(deflayer base
@escctrl
)
'';
};
};
# Enable num lock on login
home-manager.users.${config.user}.xsession.numlock.enable = true;
};
}