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

(feature) Add swapLeftCtrlAndFn

Use this and never find yourself again hitting fn because of muscle
memory! (you can even physically swap the keycaps, at least on M series)

Keycodes have been pulled from https://hidutil-generator.netlify.app/
and the hex value has been converted to a base 10 int.
This commit is contained in:
Maxime Daffis 2024-07-02 14:22:37 +02:00
parent f7142b8024
commit 636d1a09d8
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."; 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 { system.keyboard.userKeyMapping = mkOption {
internal = true; internal = true;
type = types.listOf (types.attrsOf types.int); type = types.listOf (types.attrsOf types.int);
@ -66,6 +72,14 @@ in
HIDKeyboardModifierMappingSrc = 30064771298; HIDKeyboardModifierMappingSrc = 30064771298;
HIDKeyboardModifierMappingDst = 30064771299; HIDKeyboardModifierMappingDst = 30064771299;
}) })
(mkIf cfg.swapLeftCtrlAndFn {
HIDKeyboardModifierMappingSrc = 30064771296;
HIDKeyboardModifierMappingDst = 1095216660483;
})
(mkIf cfg.swapLeftCtrlAndFn {
HIDKeyboardModifierMappingSrc = 1095216660483;
HIDKeyboardModifierMappingDst = 30064771296;
})
]; ];
system.activationScripts.keyboard.text = optionalString cfg.enableKeyMapping '' system.activationScripts.keyboard.text = optionalString cfg.enableKeyMapping ''

View file

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