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

fix: remove manual wait4path in karabiner elements

This commit is contained in:
will 2024-09-08 18:12:38 +10:00
parent 75d36c1124
commit 99b91e841e
No known key found for this signature in database

View file

@ -38,14 +38,11 @@ in
# the system extension is activated, so we can call activate from the manager
# which will block until the system extension is activated.
launchd.daemons.start_karabiner_daemons = {
serviceConfig.ProgramArguments = [
"/bin/sh" "-c"
"/bin/wait4path /nix/store && ${pkgs.writeScript "start_karabiner_daemons" ''
script = ''
${parentAppDir}/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
launchctl kickstart system/org.pqrs.karabiner.karabiner_grabber
launchctl kickstart system/org.pqrs.karabiner.karabiner_observer
''}"
];
'';
serviceConfig.Label = "org.nixos.start_karabiner_daemons";
serviceConfig.RunAtLoad = true;
};
@ -73,11 +70,7 @@ in
};
launchd.daemons.Karabiner-DriverKit-VirtualHIDDeviceClient = {
serviceConfig.ProgramArguments = [
"/bin/sh" "-c"
# For unknown reasons this daemon will fail if VirtualHIDDeviceClient is not exec'd.
"/bin/wait4path /nix/store && exec \"${pkgs.karabiner-elements.driver}/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-DriverKit-VirtualHIDDeviceClient.app/Contents/MacOS/Karabiner-DriverKit-VirtualHIDDeviceClient\""
];
command = "${pkgs.karabiner-elements.driver}/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-DriverKit-VirtualHIDDeviceClient.app/Contents/MacOS/Karabiner-DriverKit-VirtualHIDDeviceClient";
serviceConfig.ProcessType = "Interactive";
serviceConfig.Label = "org.pqrs.Karabiner-DriverKit-VirtualHIDDeviceClient";
serviceConfig.KeepAlive = true;
@ -95,23 +88,17 @@ in
# We need this to run every reboot as /run gets nuked so we can't put this
# inside the preActivation script as it only gets run on darwin-rebuild switch.
launchd.daemons.setsuid_karabiner_session_monitor = {
serviceConfig.ProgramArguments = [
"/bin/sh" "-c"
"/bin/wait4path /nix/store && ${pkgs.writeScript "setsuid_karabiner_session_monitor" ''
script = ''
rm -rf /run/wrappers
mkdir -p /run/wrappers/bin
install -m4555 "${pkgs.karabiner-elements}/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_session_monitor" /run/wrappers/bin
''}"
];
'';
serviceConfig.RunAtLoad = true;
serviceConfig.KeepAlive.SuccessfulExit = false;
};
launchd.user.agents.karabiner_session_monitor = {
serviceConfig.ProgramArguments = [
"/bin/sh" "-c"
"/bin/wait4path /run/wrappers/bin && /run/wrappers/bin/karabiner_session_monitor"
];
command = "/run/wrappers/bin/karabiner_session_monitor";
serviceConfig.Label = "org.pqrs.karabiner.karabiner_session_monitor";
serviceConfig.KeepAlive = true;
};