From d691934215b2e8ee3515b6502ab148915b1e936c Mon Sep 17 00:00:00 2001 From: rocketcamel Date: Fri, 27 Jun 2025 00:58:44 -0700 Subject: [PATCH] feat: add apple kanata layout --- nix/hosts/kumatani/configuration.nix | 1 + nix/modules/kanata.nix | 57 +++++++++++++++++++++------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/nix/hosts/kumatani/configuration.nix b/nix/hosts/kumatani/configuration.nix index 834d30f..dd9c600 100644 --- a/nix/hosts/kumatani/configuration.nix +++ b/nix/hosts/kumatani/configuration.nix @@ -46,6 +46,7 @@ desktop.enable = true; kanata.enable = true; + kanata.apple = true; users.users.luca = { isNormalUser = true; extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. diff --git a/nix/modules/kanata.nix b/nix/modules/kanata.nix index fa05047..dc374c1 100644 --- a/nix/modules/kanata.nix +++ b/nix/modules/kanata.nix @@ -7,25 +7,54 @@ { options.kanata = { enable = lib.mkEnableOption "enable kanata"; + apple = lib.mkEnableOption "enable apple"; }; config = lib.mkIf config.kanata.enable { services.kanata.enable = true; - services.kanata.keyboards.main = { - config = '' - (defsrc - caps - ) + services.kanata.keyboards = + if !config.kanata.apple then + { + main = { + config = '' + (defsrc + caps + ) - (defalias - caps-mod esc - ) + (defalias + caps-mod esc + ) - (deflayer base - @caps-mod - ) - ''; - extraDefCfg = "process-unmapped-keys yes"; - }; + (deflayer base + @caps-mod + ) + ''; + extraDefCfg = "process-unmapped-keys yes"; + }; + } + else + { + main = { + config = '' + (defsrc + caps + lalt + lmet + ) + + (defalias + caps-mod esc + alt-mod lmet + met-mod lalt + ) + + (deflayer base + @caps-mod + @alt-mod + @met-mod + ) + ''; + }; + }; }; }