Overview
Actions run straight from the hotkey callback. If one is still running
after a short delay, a ● appears in the menu bar until it finishes. Each
press also logs when the key was received and how long the action took, so
slow hotkeys are easy to spot in the Console.
Download: https://github.com/hugoh/AppLauncher.spoon/releases/latest
Variables
Show Hammerspoon's hotkey alert with the mapping's name on each press (default: false).
Seconds an action may run before a ● appears in the menu bar, or false
to never show it (default: 0.2). The indicator can only appear while
Hammerspoon's main thread is free, e.g. while an app launches or an async
function waits; work that blocks the main thread shows nothing.
Seconds after which an action that hasn't finished (e.g. an async
function that never calls done) stops counting as running, so the
indicator can't get stuck; false to wait forever (default: 5).
Seconds an action must take before its elapsed time is logged, 0 to
always log it, or false to never log it (default: 0.1).
Methods
Called automatically by hs.loadSpoon(). Logs the loaded version.
Sets one or more of AppLauncher's variables (notify, indicatorDelay,
actionTimeout, logElapsedAbove) from a table. Call it before registerMappings, since notify
is read when hotkeys are bound.
Parameters
opts- a table with any of the variable names above as keys
Returns
- The AppLauncher object, for method chaining
Binds a hotkey for each mapping.
Parameters
mods- a table of modifier keys shared by all mappings, e.g.{ "ctrl", "alt", "cmd" }mappings- a list of tables, each with akeyand one action:app- name of an app to focus, launching it if needed; setforceOpen = trueto always go throughhs.application.launchOrFocus; activating brings all of the app's windows forward (a running app with no window goes throughlaunchOrFocusso one reopens), andraiseWindows = truealso raises each window individually (off by default: it can take ~150 ms per window in some apps, e.g. Electron ones, blocking Hammerspoon meanwhile)open- a file, folder or URL passed to/usr/bin/openfunc- a function to call; withasync = trueit receives adonecallback to call when finished; the action counts as running until thenlabel- optional name for afuncmapping, used in logs and alerts
Returns
- The AppLauncher object, for method chaining