mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-07 17:41:03 +01:00
macos-remap-keys: add (#6605)
A module to remap keys using macos native tool (hidutil)
This commit is contained in:
parent
ef257da52a
commit
6576167e6b
7 changed files with 248 additions and 0 deletions
22
tests/modules/services/macos-remap-keys/basic-agent.plist
Normal file
22
tests/modules/services/macos-remap-keys/basic-agent.plist
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>SuccessfulExit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>Label</key>
|
||||
<string>org.nix-community.home.remap-keys</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/bin/hidutil</string>
|
||||
<string>property</string>
|
||||
<string>--set</string>
|
||||
<string>{ "UserKeyMapping": [ { "HIDKeyboardModifierMappingSrc": 0x700000039, "HIDKeyboardModifierMappingDst": 0x70000002A } ] }</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
services.macos-remap-keys = {
|
||||
enable = true;
|
||||
keyboard = { Capslock = "Backspace"; };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
launchAgent=LaunchAgents/org.nix-community.home.remap-keys.plist
|
||||
assertFileExists "$launchAgent"
|
||||
assertFileContent "$launchAgent" ${./basic-agent.plist}
|
||||
'';
|
||||
}
|
||||
1
tests/modules/services/macos-remap-keys/default.nix
Normal file
1
tests/modules/services/macos-remap-keys/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ macos-remap-keys-basic-configuration = ./basic-configuration.nix; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue