Add Kanata to manage keyboard layout

This commit is contained in:
Erwin Boskma 2023-05-17 08:06:05 +02:00
parent eff95c59f4
commit 55df110124
Signed by: erwin
SSH key fingerprint: SHA256:3F6Cm6I3erRqlBwEghZWAQl6eS5WrGTX1Vs/Evec1lQ
3 changed files with 75 additions and 11 deletions

View file

@ -49,7 +49,12 @@
}; };
fonts.enable = true; fonts.enable = true;
gnome.enable = true; gnome.enable = true;
# greetd.enable = true; kanata = {
enable = true;
devices = [
"/dev/input/by-id/usb-04d9_USB-HID_Keyboard-event-kbd"
];
};
lightdm.enable = true; lightdm.enable = true;
networking.enable = true; networking.enable = true;
nix-common = { nix-common = {

View file

@ -0,0 +1,59 @@
{ config, lib, ... }:
with lib;
let
cfg = config.eboskma.kanata;
in
{
options.eboskma.kanata = {
enable = mkEnableOption "kanata";
devices = mkOption {
description = "Devices to enable kanata for";
type = types.listOf types.path;
};
};
config = mkIf cfg.enable {
services.kanata = {
enable = true;
keyboards = {
ducky = {
devices = cfg.devices;
config = ''
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prtsc scrlck pp calc mute voldwn volu
grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup nlck kp/ kp* kp-
tab q w e r t y u i o p [ ] \ del end pgdn kp7 kp8 kp9 kp+
caps a s d f g h j k l ; ' ret kp4 kp5 kp6
lsft z x c v b n m , . / rsft up kp1 kp2 kp3 kprt
lctl lmet lalt spc ralt rmet rctl lft down rght kp0 kp.)
(deflayer colemak
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prtsc @qwe pp calc mute voldwn volu
grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup nlck kp/ kp* kp-
tab q w f p g j l u y ; [ ] \ del end pgdn kp7 kp8 kp9 kp+
@cap a r s t d h n e i o ' ret kp4 kp5 kp6
lsft z x c v b k m , . / rsft up kp1 kp2 kp3 kprt
lctl lmet lalt spc ralt rmet rctl lft down rght kp0 kp.)
(deflayer qwerty
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prtsc @col pp calc mute voldwn volu
grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup nlck kp/ kp* kp-
tab q w e r t y u i o p [ ] \ del end pgdn kp7 kp8 kp9 kp+
@cap a s d f g h j k l ; ' ret kp4 kp5 kp6
lsft z x c v b n m , . / rsft up kp1 kp2 kp3 kprt
lctl lmet lalt spc ralt rmet rctl lft down rght kp0 kp.)
(defalias
cap (tap-hold 100 100 bspc lctl)
col (layer-switch colemak)
qwe (layer-switch qwerty)
)
'';
};
};
};
};
}

View file

@ -93,12 +93,12 @@ in
}; };
}; };
home.keyboard = { # home.keyboard = {
layout = "us,us"; # layout = "us,us";
variant = "colemak,"; # variant = "colemak,";
model = "pc105"; # model = "pc105";
options = [ "ctrl:nocaps" "eurosign:5" "lv5:ralt_switch" "lv3:rwin_switch" "grp:sclk_toggle" "grp_led:scroll" ]; # options = [ "ctrl:nocaps" "eurosign:5" "lv5:ralt_switch" "lv3:rwin_switch" "grp:sclk_toggle" "grp_led:scroll" ];
}; # };
home.packages = with pkgs; [ home.packages = with pkgs; [
atool atool
@ -229,10 +229,10 @@ in
]; ];
services.xserver = { services.xserver = {
layout = "us,us"; # layout = "us,us";
xkbVariant = "colemak,"; # xkbVariant = "colemak,";
xkbModel = "pc105"; # xkbModel = "pc105";
xkbOptions = "ctrl:nocaps,eurosign:5,lv5:ralt_switch,lv3:rwin_switch,grp:shifts_toggle"; # xkbOptions = "ctrl:nocaps,eurosign:5,lv5:ralt_switch,lv3:rwin_switch,grp:shifts_toggle";
upscaleDefaultCursor = false; upscaleDefaultCursor = false;
exportConfiguration = true; exportConfiguration = true;