@@ -193,7 +193,7 @@ public enum KeyboardShortcuts {
193193
194194 This can be used to reset the handlers before re-creating them to avoid having multiple handlers for the same shortcut.
195195
196- - Note: This method does not affect listeners using `.on() `.
196+ - Note: This method does not affect listeners using ``events(for:)` `.
197197 */
198198 public static func removeAllHandlers( ) {
199199 let shortcutsToUnregister = shortcutsForLegacyHandlers. subtracting ( shortcutsForStreamHandlers)
@@ -241,7 +241,7 @@ public enum KeyboardShortcuts {
241241
242242 - Parameter name: The name of the keyboard shortcut to remove handlers for.
243243
244- - Note: This method does not affect listeners using `.on() `.
244+ - Note: This method does not affect listeners using ``events(for:)` `.
245245 */
246246 public static func removeHandler( for name: Name ) {
247247 legacyKeyDownHandlers [ name] = nil
@@ -258,6 +258,28 @@ public enum KeyboardShortcuts {
258258 unregister ( shortcut)
259259 }
260260
261+ /**
262+ Returns whether the keyboard shortcut for the given name is enabled.
263+
264+ This checks if the shortcut is registered and will trigger handlers. It respects the global ``isEnabled``.
265+
266+ ```swift
267+ let isEnabled = KeyboardShortcuts.isEnabled(for: .toggleUnicornMode)
268+ ```
269+
270+ - Tip: Use ``disable(_:)-(Name...)`` and ``enable(_:)-(Name...)`` to change the status.
271+ */
272+ public static func isEnabled( for name: Name ) -> Bool {
273+ guard
274+ isEnabled,
275+ let shortcut = getShortcut ( for: name)
276+ else {
277+ return false
278+ }
279+
280+ return registeredShortcuts. contains ( shortcut)
281+ }
282+
261283 /**
262284 Disable the keyboard shortcut for one or more names.
263285 */
@@ -469,6 +491,8 @@ public enum KeyboardShortcuts {
469491
470492 You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
471493
494+ - Important: This will be deprecated in the future. Prefer ``events(for:)`` for new code.
495+
472496 ```swift
473497 import AppKit
474498 import KeyboardShortcuts
@@ -498,6 +522,8 @@ public enum KeyboardShortcuts {
498522
499523 You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
500524
525+ - Important: This will be deprecated in the future. Prefer ``events(for:)`` for new code.
526+
501527 ```swift
502528 import AppKit
503529 import KeyboardShortcuts
0 commit comments