dotfiles/modules/nixos/hardware/keyboard.nix

43 lines
1.0 KiB
Nix
Raw Permalink Normal View History

{ config, lib, ... }:
2024-04-20 13:42:06 +00:00
{
2022-04-29 02:12:16 +00:00
2024-03-24 18:55:17 +00:00
config = lib.mkIf config.physical {
2022-05-29 17:44:45 +00:00
2023-03-21 22:37:22 +00:00
services.xserver = {
2022-05-29 17:44:45 +00:00
2024-02-07 04:41:28 +00:00
xkb.layout = "us";
2022-04-29 02:12:16 +00:00
2023-03-21 22:37:22 +00:00
# Keyboard responsiveness
autoRepeatDelay = 250;
autoRepeatInterval = 40;
2023-06-06 03:50:01 +00:00
};
2023-03-21 22:37:22 +00:00
# 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 = {
2023-06-06 03:50:01 +00:00
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
)
'';
2023-07-25 03:16:48 +00:00
};
2023-03-21 22:37:22 +00:00
};
# Enable num lock on login
home-manager.users.${config.user}.xsession.numlock.enable = true;
2022-04-29 02:12:16 +00:00
};
}