nixos-config/nixos/components/gui/kmonad.nix

89 lines
4.5 KiB
Nix

{ config, pkgs, lib, ... }:
{
options.components.gui.kmonad.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
config = lib.mkIf (config.components.gui.kmonad.enable) {
# only needed if you have an UHK
hardware.keyboard.uhk.enable = true;
environment.systemPackages = [ pkgs.unstable.uhk-agent ];
users.users.mainUser.extraGroups = [ "input" ];
services.xserver = {
layout = "us";
xkbOptions = "compose:ralt";
};
services.kmonad = {
enable = true;
keyboards =
let
keyboard = device: leftOfSpace: {
device = device;
extraGroups = [ "video" ];
defcfg = {
enable = true;
fallthrough = true;
allowCommands = true;
};
config = ''
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
${lib.concatStringsSep " " leftOfSpace} spc ralt rmet cmp rctl
)
(defalias sym (layer-toggle symbols))
(defalias alt (around (layer-toggle alt-qwerty)
(layer-toggle arrows)))
(deflayer qwerty
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
esc a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet @alt spc @sym rmet cmp rctrl
)
(deflayer symbols
_ ½ ² ³ _ _ _
_ _ _ _ _ ü _ ö _ _ _ _
caps ä ß _ _ _ _ _ _ _ _ _ _
_ _ _ ¢ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _)
;; alt => alt
;; alt + jkli => left down right up
;; alt + caps + jkli => alt + left down right up
(deflayer alt-qwerty
(around lalt grv ) (around lalt 1) (around lalt 2) (around lalt 3) (around lalt 4) (around lalt 5 ) (around lalt 6) (around lalt 7) (around lalt 8) (around lalt 9) (around lalt 0) (around lalt - ) (around lalt = ) (around lalt bspc)
_ (around lalt q) (around lalt w) (around lalt e) (around lalt r) (around lalt t ) (around lalt y) (around lalt u) (around lalt i) (around lalt o) (around lalt p) (around lalt [ ) (around lalt ] ) (around lalt \ )
_ (around lalt a) (around lalt s) (around lalt d) (around lalt f) (around lalt g ) (around lalt h) (around lalt j) (around lalt k) (around lalt l) (around lalt ;) (around lalt ' ) (around lalt ret)
_ (around lalt z) (around lalt x) (around lalt c) (around lalt v) (around lalt b ) (around lalt n) (around lalt m) (around lalt ,) (around lalt .) (around lalt /) (around lalt rsft)
_ _ _ (around lalt spc) _ _ _ _
)
(deflayer arrows
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ up _ _ _ _ _
lalt _ _ _ _ _ _ left down right _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _)
'';
};
in
{
nativ = keyboard "/dev/input/by-path/platform-i8042-serio-0-event-kbd" [ "lctl" "lmet" "lalt" ];
dasKeyboard = keyboard "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-event-kbd" [ "lctl" "lmet" "lalt" ];
uhk = keyboard "/dev/input/by-id/usb-Ultimate_Gadget_Laboratories_UHK_60_v2-if01-event-kbd" [ "lctl" "lmet" "lalt" ];
};
};
};
}