nixos-config/components/gui/kmonad.nix

89 lines
4.5 KiB
Nix
Raw Permalink Normal View History

2023-06-02 16:40:40 +02:00
{ config, pkgs, lib, ... }:
2023-06-02 14:08:07 +02:00
{
2023-06-02 16:40:40 +02:00
options.components.gui.kmonad.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
2023-06-02 16:11:06 +02:00
};
2023-06-02 16:40:40 +02:00
config = lib.mkIf (config.components.gui.kmonad.enable) {
2023-06-07 15:31:47 +02:00
# only needed if you have an UHK
hardware.keyboard.uhk.enable = true;
environment.systemPackages = [ pkgs.uhk-agent ];
2023-06-07 15:31:47 +02:00
users.users.mainUser.extraGroups = [ "input" ];
2023-06-02 16:40:40 +02:00
services.xserver = {
2024-05-24 21:08:34 +02:00
xkb.layout = "us";
xkb.options = "compose:ralt";
2023-06-02 14:08:07 +02:00
};
2023-06-02 16:40:40 +02:00
services.kmonad = {
enable = true;
keyboards =
let
keyboard = device: leftOfSpace: {
2023-06-02 16:40:40 +02:00
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
2023-06-02 16:40:40 +02:00
)
(defalias sym (layer-toggle symbols))
2023-07-11 07:41:46 +02:00
(defalias alt (around (layer-toggle alt-qwerty)
(layer-toggle arrows)))
2023-06-02 16:40:40 +02:00
(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
2023-07-11 07:41:46 +02:00
lctl lmet @alt spc @sym rmet cmp rctrl
2023-06-02 16:40:40 +02:00
)
(deflayer symbols
_ ½ ² ³ _ _ _
_ _ _ _ _ ü _ ö _ _ _ _
caps ä ß _ _ _ _ _ _ _ _ _ _
_ _ _ ¢ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _)
2023-07-11 07:41:46 +02:00
2023-07-14 09:53:41 +02:00
;; alt => alt
;; alt + jkli => left down right up
;; alt + caps + jkli => alt + left down right up
2023-07-11 07:41:46 +02:00
(deflayer alt-qwerty
2023-07-11 07:44:25 +02:00
(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)
2023-07-11 08:15:27 +02:00
_ (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)
2023-07-11 07:44:25 +02:00
_ _ _ (around lalt spc) _ _ _ _
2023-07-11 07:41:46 +02:00
)
(deflayer arrows
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ up _ _ _ _ _
lalt _ _ _ _ _ _ left down right _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _)
2023-06-02 16:40:40 +02:00
'';
};
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" ];
2024-05-06 07:53:14 +02:00
uhk = keyboard "/dev/input/by-id/usb-Ultimate_Gadget_Laboratories_UHK_60_v2-event-kbd" [ "lctl" "lmet" "lalt" ];
2023-06-02 16:40:40 +02:00
};
};
2023-06-02 14:08:07 +02:00
};
}