7/27/2023 0 Comments Hammerspoon hacks![]() By using a combination of private APIs and Accessibility hacks (via hs.axuielement), some basic functions for controlling the use of Spaces is possible with Hammerspoon, but there are some limitations and caveats. The functionality provided by this module is considered experimental and subject to change. The hs.This module provides some basic functions for controlling macOS Spaces.Hs.hotkey.new(mods, key, pressedfn, releasedfn, repeatfn) -> hs.hotkey object This function is just a wrapper that performs hs.hotkey.bind(keyspec, keyspec.A new hs.hotkey object for method chaining.All remaining arguments are as specified in hs.hotkey.bind() second, a string containing the name of a keyboard key, as specified in hs.hotkey.bind().first, a table containing keyboard modifiers, as specified in hs.hotkey.bind().keyspec - A table containing two items:.) -> hs.hotkey objectĬreates a hotkey and enables it immediately You must pass at least one of pressedfn, releasedfn or repeatfn to delete a hotkey, use hs.hotkey:delete().Will be interpreted as a missing pressedfn If you don't want any alert, you must actually omit the message parameter a nil in 3rd position.If message is the empty string "", the alert will just show the triggered keyboard combination.You can create multiple hs.hotkey objects for the same keyboard combination, but only one can be activeĪt any given time - see hs.hotkey:enable().This function is just a wrapper that performs hs.hotkey.new(.):enable().A new hs.hotkey object or nil if the hotkey could not be enabled.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.message - (optional) A string containing a message to be displayed via hs.alert() when the hotkey has been triggered if omitted, no alert will be shown.Hs.hotkey.bind(mods, key, pressedfn, releasedfn, repeatfn) -> hs.hotkey objectĬreates a new hotkey and enables it immediately this is provided for informational purposes and does not provide a reliable test as to whether or not Hammerspoon can use the combination to create a custom hotkey - some combinations which return a table can be over-ridden by Hammerspoon while others cannot.if the hotkey combination is not in use by the operating system, returns the boolean value false.enabled - a boolean indicating whether or not the key is currently enabled.mods - a numeric representation of the modifier flags for the hotkey.keycode - the numeric keycode for the hotkey.if the hotkey combination is in use by a system function, returns a table containing the following keys:.Hs.hotkey.systemAssigned(mods, key) -> table | falseĮxamine whether a potential hotkey is in use by the macOS system such as the Screen Capture, Universal Access, and Keyboard Navigation keys. enabled and not "shadowed" in the current context) while pressed Hs.hotkey.showHotkeys(mods, key) -> hs.hotkey objectĬreates (and enables) a hotkey that shows all currently active hotkeys (i.e. ![]() ![]()
0 Comments
Leave a Reply. |