Is there any way to prevent the system shortcut key (Shift+Cmd+4) from working when entering text on a Mac?

Asked 1 years ago, Updated 1 years ago, 360 views

In macOS 10.15, we are creating an application (Swift) to capture text (TextFilet) keystrokes, but if you press the key that is registered in the shortcut key on the system, the shortcut functionality will work.
Is there any way to prevent shortcut function in the app?

[Example Shortcut Key]
·Shift+Cmd+4→Screen capture works
·Control+space→Input switching works
·Command+space→Spotlight works

When you press a shortcut, keyDown() is not also called, so you can't find a solution.

swift macos

2022-09-30 21:50

1 Answers

Self-resolved.

By using CGEvent.tapCreate(), you were able to disable all input events on your keyboard.


2022-09-30 21:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.