Skip to content

Instantly share code, notes, and snippets.

@doraorak
Last active February 21, 2026 03:07
Show Gist options
  • Select an option

  • Save doraorak/a76c529b41677c32948599c74311c0ee to your computer and use it in GitHub Desktop.

Select an option

Save doraorak/a76c529b41677c32948599c74311c0ee to your computer and use it in GitHub Desktop.
Remove capslock delay on macOS
//effect goes away after rebooting, automation is recommended
void* handle = dlopen("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/HIServices", RTLD_NOW);
xpc_connection_t conn = xpc_connection_create("com.apple.hiservices-xpcservice", NULL);
if (conn == NULL) {
NSLog(@"Error creating connection");
return;
}
xpc_connection_set_event_handler(conn, ^(xpc_object_t event) {
NSLog(@"[mydebug] Event: %@", event);
});
xpc_connection_resume(conn);
xpc_object_t msg = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_string(msg, "HIS_XPC_SELECTOR", "HIS_XPC_SetCapsLockDelayOverride:");
xpc_object_t params = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_bool(params, "capsLockDelayOverride", true);
xpc_dictionary_set_value(msg, "HIS_XPC_PARAMETERS", params);
xpc_connection_send_message_with_reply_sync(conn, msg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment