2024-04-20 09:42:06 -04:00
|
|
|
{
|
2025-01-20 22:35:40 -05:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2022-04-28 22:12:16 -04:00
|
|
|
|
2025-01-20 22:35:40 -05:00
|
|
|
let
|
|
|
|
cfg = config.nmasur.presets.services.kanata;
|
|
|
|
in
|
2022-05-29 13:44:45 -04:00
|
|
|
|
2025-01-20 22:35:40 -05:00
|
|
|
{
|
2022-05-29 13:44:45 -04:00
|
|
|
|
2025-01-20 22:35:40 -05:00
|
|
|
options.nmasur.presets.services.kanata.enable = lib.mkEnableOption "Kanata keyboard manager";
|
2022-04-28 22:12:16 -04:00
|
|
|
|
2025-01-20 22:35:40 -05:00
|
|
|
config = lib.mkIf cfg.enable {
|
2023-03-21 18:37:22 -04:00
|
|
|
|
2024-08-07 23:24:26 -04: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-05 23:50:01 -04:00
|
|
|
enable = true;
|
2024-08-07 23:24:26 -04:00
|
|
|
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 18:37:22 -04:00
|
|
|
};
|
|
|
|
|
2022-04-28 22:12:16 -04:00
|
|
|
};
|
|
|
|
}
|