Create/manage modal keyboard shortcut environments
Usage:
k = hs.hotkey.modal.new('cmd-shift', 'd')
function k:entered() hs.alert'Entered mode' end
function k:exited() hs.alert'Exited mode' end
k:bind('', 'escape', function() k:exit() end)
k:bind('', 'J', 'Pressed J',function() print'let the record show that J was pressed' end)
| Signature | hs.hotkey.modal.new(mods, key, message) -> hs.hotkey.modal object |
|---|---|
| Type | Constructor |
| Description | Creates a new modal state, optionally with a global keyboard combination to trigger it |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:bind(mods, key, message, pressedfn, releasedfn, repeatfn) -> hs.hotkey.modal object |
|---|---|
| Type | Method |
| Description | Creates a hotkey that is enabled/disabled as the modal is entered/exited |
| Parameters |
|
| Returns |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:delete() |
|---|---|
| Type | Method |
| Description | Deletes a modal hotkey object without calling :exited() |
| Parameters |
|
| Returns |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:enter() -> hs.hotkey.modal object |
|---|---|
| Type | Method |
| Description | Enters a modal state |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:entered() |
|---|---|
| Type | Method |
| Description | Optional callback for when a modal is entered |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:exit() -> hs.hotkey.modal object |
|---|---|
| Type | Method |
| Description | Exits a modal state |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/hotkey/init.lua |
| Signature | hs.hotkey.modal:exited() |
|---|---|
| Type | Method |
| Description | Optional callback for when a modal is exited |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/hotkey/init.lua |