remap capslock
This commit is contained in:
@@ -36,6 +36,7 @@ if !builtins.elem vacuModuleType expectedModuleTypes then builtins.throw "error:
|
||||
./minimal-nixos.nix
|
||||
./acmeDependencies.nix
|
||||
./nix-on-droid.nix
|
||||
./remapCapsLock.nix
|
||||
];
|
||||
options = {
|
||||
vacu.rootCAs = mkOption { type = types.listOf types.str; };
|
||||
|
35
common/remapCapsLock.nix
Normal file
35
common/remapCapsLock.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
vacuModuleType,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
lib.optionalAttrs (vacuModuleType == "nixos") {
|
||||
options.vacu.enableCapsLockRemap = mkOption {
|
||||
type = types.bool;
|
||||
default = config.vacu.systemKind == "desktop";
|
||||
};
|
||||
config = lib.mkIf config.vacu.enableCapsLockRemap {
|
||||
# https://discourse.nixos.org/t/best-way-to-remap-caps-lock-to-esc-with-wayland/39707/6
|
||||
services.interception-tools =
|
||||
let
|
||||
itools = pkgs.interception-tools;
|
||||
itools-caps = pkgs.interception-tools-plugins.caps2esc;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
plugins = [ itools-caps ];
|
||||
# requires explicit paths: https://github.com/NixOS/nixpkgs/issues/126681
|
||||
udevmonConfig = pkgs.lib.mkDefault ''
|
||||
- JOB: "${itools}/bin/intercept -g $DEVNODE | ${itools-caps}/bin/caps2esc -m 1 | ${itools}/bin/uinput -d $DEVNODE"
|
||||
DEVICE:
|
||||
EVENTS:
|
||||
EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user