DropletShortcutsService

Registers global keyboard shortcuts the user can rebind in Droppy's Settings, Shortcuts page.

@MainActor protocol DropletShortcutsService : AnyObject

Requires the global-shortcuts capability.

Methods

currentShortcut(id:)

@MainActor func currentShortcut(id: String) -> DropletKeyboardShortcut?

The binding currently attached to one of your shortcut ids.

register(id:title:defaultShortcut:handler:)

@MainActor func register(id: String, title: String, defaultShortcut: DropletKeyboardShortcut?, handler: @escaping @MainActor @Sendable () -> Void)

Declares a shortcut. The id is namespaced to the droplet. title is what the user sees in Settings. defaultShortcut is only a suggestion; the host drops it when it collides with an existing binding.

unregister(id:)

@MainActor func unregister(id: String)

Removes a shortcut this droplet registered. Called for you on deactivate(), so you only need this to retire one early.