2024-05-06 22:11:33 +03:00
|
|
|
{ pkgs, lib, ... }: {
|
2024-04-24 04:22:34 +03:00
|
|
|
environment.systemPackages = with pkgs; [ keyd ];
|
2024-04-24 03:32:59 +03:00
|
|
|
services.keyd = {
|
|
|
|
enable = true;
|
|
|
|
keyboards.default = {
|
|
|
|
ids = [ "*" ];
|
|
|
|
settings = {
|
|
|
|
main = {
|
2024-05-06 19:34:00 +03:00
|
|
|
backspace = "delete"; # Delete key on backspace.
|
|
|
|
capslock = "overload(control, esc)"; # Ctrl/esc combo.
|
|
|
|
compose = "layer(layer_macro)"; # Input macros.
|
|
|
|
esc = "layer(layer_system)"; # System controls.
|
|
|
|
leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc.
|
|
|
|
print = "layer(layer_macro)"; # ThinkPad remap to compose.
|
|
|
|
rightalt = "capslock"; # Language toggle.
|
|
|
|
rightcontrol = "layer(layer_control)"; # Media and other controls.
|
|
|
|
rightshift = "backspace"; # Backspace.
|
2024-04-24 03:32:59 +03:00
|
|
|
};
|
2024-04-24 04:22:34 +03:00
|
|
|
|
2024-04-24 17:57:39 +03:00
|
|
|
layer_alternative = {
|
2024-04-24 04:22:34 +03:00
|
|
|
w = "pageup";
|
|
|
|
a = "home";
|
|
|
|
s = "pagedown";
|
|
|
|
d = "end";
|
|
|
|
x = "cut";
|
|
|
|
c = "copy";
|
|
|
|
v = "paste";
|
|
|
|
h = "left";
|
|
|
|
j = "down";
|
|
|
|
k = "up";
|
|
|
|
l = "right";
|
2024-04-27 02:37:03 +03:00
|
|
|
# space = "macro2(1, 100, macro(space))"; # NOTE: Possible bhop example.
|
2024-04-24 04:22:34 +03:00
|
|
|
};
|
|
|
|
|
2024-04-24 17:57:39 +03:00
|
|
|
layer_control = {
|
|
|
|
space = "playpause";
|
|
|
|
w = "volumeup";
|
|
|
|
s = "volumedown";
|
2024-04-25 04:10:00 +03:00
|
|
|
d = "forward";
|
|
|
|
a = "back";
|
|
|
|
e = "nextsong";
|
|
|
|
q = "previoussong";
|
2024-04-30 19:00:27 +03:00
|
|
|
x = "mute";
|
2024-05-04 21:58:43 +03:00
|
|
|
z = "stopcd";
|
2024-04-24 17:57:39 +03:00
|
|
|
};
|
2024-04-24 04:22:34 +03:00
|
|
|
|
2024-05-06 19:34:00 +03:00
|
|
|
layer_system = {
|
2024-05-08 18:26:33 +03:00
|
|
|
c = "command(loginctl kill-user voronind)";
|
2024-05-06 19:34:00 +03:00
|
|
|
l = "command(powerlimit toggle)";
|
2024-05-08 18:26:33 +03:00
|
|
|
# m = "command(swayscript montoggle)";
|
|
|
|
p = "command(powersave toggle)";
|
|
|
|
# v = "command(swayscript vrrtoggle)";
|
2024-05-07 14:57:30 +03:00
|
|
|
x = "command(systemctl poweroff -i)";
|
2024-05-08 18:26:33 +03:00
|
|
|
z = "command(systemctl suspend -i)";
|
2024-05-06 19:34:00 +03:00
|
|
|
};
|
2024-04-24 17:57:39 +03:00
|
|
|
|
2024-05-06 19:34:00 +03:00
|
|
|
layer_macro = {};
|
2024-04-24 03:32:59 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-04-24 04:58:58 +03:00
|
|
|
|
|
|
|
# HACK: Workaround for https://github.com/NixOS/nixpkgs/issues/290161
|
|
|
|
users.groups.keyd = {};
|
|
|
|
systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ "CAP_SETGID" ];
|
2024-05-06 22:11:33 +03:00
|
|
|
|
2024-05-08 18:26:33 +03:00
|
|
|
# HACK: Workaround for powersave/powerlimit/swayscript scripts.
|
2024-05-06 22:11:33 +03:00
|
|
|
systemd.services.keyd.serviceConfig.ProtectKernelTunables = lib.mkForce false;
|
2024-05-08 18:26:33 +03:00
|
|
|
systemd.services.keyd.serviceConfig.ProtectHome = lib.mkForce false;
|
|
|
|
# systemd.services.keyd.environment.KEYD_DEBUG = "1";
|
2024-04-24 03:32:59 +03:00
|
|
|
}
|