![]() ![]() Hs.hotkey.modal:exit() -> hs.hotkey. ![]() This is a pre-existing function that you should override if you need to use it the default implementation does nothing.Optional callback for when a modal is entered If the modal state was created with a keyboard combination, this method will be called automatically.This method will enable all of the hotkeys defined in the modal state via hs.hotkey.modal:bind(),Īnd disable the hotkey that entered the modal state (if one was defined).Hs.hotkey.modal:enter() -> hs.hotkey.modal object The hs.hotkey.modal object for method chainingĭeletes a modal hotkey object without calling :exited().repeatfn - A function that will be called when a pressed hotkey is repeating, or nil. ![]() releasedfn - A function that will be called when the hotkey has been released, or nil.pressedfn - A function that will be called when the hotkey has been pressed, or nil.Hs.hotkey.modal:bind(mods, key, message, pressedfn, releasedfn, repeatfn) -> hs.hotkey.modal objectĬreates a hotkey that is enabled/disabled as the modal is entered/exited If key is nil, no global hotkey will be registered (all other parameters will be ignored).message - A string containing a message to be displayed via hs.alert() when the hotkey has been triggered, or nil for no alert.key - A string containing the name of a keyboard key (as found in hs.keycodes.map ), or a raw keycode number.mods - A table or a string containing (as elements, or as substrings with any separator) the keyboard modifiers required, which should be zero or more of the following:.Hs.(mods, key, message) -> hs.hotkey.modal objectĬreates a new modal state, optionally with a global keyboard combination to trigger it Methods - API calls which can only be made on an object returned by a constructorĪPI Documentation Constructors new Signature.Constructors - API calls which return an object, typically one that offers API methods.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 ) ``` API Overview alert 'Entered mode' end function k : exited () hs. new ( 'cmd-shift', 'd' ) function k : entered () hs. Hs.hotkey.modal:bind(mods, key, message, pressedfn, releasedfn, repeatfn)įunctions could probably be defined a little more elegant and I don't understand why this does not work: hs.hotkey.bind(mods, key, message, pressedfn, releasedfn, repeatfn) -> hs.hotkey object: Type: Constructor: Description: Creates a new hotkey and enables it immediately: Parameters: mods - A table or a string containing (as elements, or as substrings with any separator) the keyboard modifiers required, which should be zero or more of the. ![]() Modal:bind("","d", "today", nil, function() hs.eventtap.keyStrokes(os.date("%F")) modal:exit() end, nil)įrom documentation, hs.hotkey.modal:bind() looks like this: An example binding I find useful: Type today's date in ISO format. Modal:bind("", "escape", " not this time.", nil, function() modal:exit() end, nil) I recommend having this one at all times: Bind the escape key to exit keybinding mode: A nice touch for usability: This also offers to show a message. in this example, Ctrl+Shift+h triggers this keybinding mode, which will allow us to use the ones defined below. I am trying to wrap my head around RecursiveBinder, but am not understanding the documentation here:įrom what I understand, it allows to add sub-keybindings. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |