1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

Merge pull request #1023 from malko42/swap-ctrl-fn

(feature) Add swapLeftCtrlAndFn
This commit is contained in:
Michael Hoang 2024-08-06 08:00:07 +02:00 committed by GitHub
commit 91010a5613
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -38,6 +38,12 @@ in
description = "Whether to swap the left Command key and left Alt key.";
};
system.keyboard.swapLeftCtrlAndFn = mkOption {
type = types.bool;
default = false;
description = "Whether to swap the left Control key and Fn (Globe) key.";
};
system.keyboard.userKeyMapping = mkOption {
internal = true;
type = types.listOf (types.attrsOf types.int);
@ -66,6 +72,14 @@ in
HIDKeyboardModifierMappingSrc = 30064771298;
HIDKeyboardModifierMappingDst = 30064771299;
})
(mkIf cfg.swapLeftCtrlAndFn {
HIDKeyboardModifierMappingSrc = 30064771296;
HIDKeyboardModifierMappingDst = 1095216660483;
})
(mkIf cfg.swapLeftCtrlAndFn {
HIDKeyboardModifierMappingSrc = 1095216660483;
HIDKeyboardModifierMappingDst = 30064771296;
})
];
system.activationScripts.keyboard.text = optionalString cfg.enableKeyMapping ''

View file

@ -6,6 +6,7 @@
system.keyboard.remapCapsLockToEscape = true;
system.keyboard.nonUS.remapTilde = true;
system.keyboard.swapLeftCommandAndLeftAlt = true;
system.keyboard.swapLeftCtrlAndFn = true;
test = ''
echo checking keyboard mappings in /activate >&2
@ -17,5 +18,7 @@
grep "\"HIDKeyboardModifierMappingDst\":30064771296" ${config.out}/activate
grep "\"HIDKeyboardModifierMappingDst\":30064771298" ${config.out}/activate
grep "\"HIDKeyboardModifierMappingDst\":30064771299" ${config.out}/activate
grep "\"HIDKeyboardModifierMappingDst\":30064771296" ${config.out}/activate
grep "\"HIDKeyboardModifierMappingDst\":1095216660483" ${config.out}/activate
'';
}