Repository navigation
Hammerspoon 2 1.0.0 Beta 5
Pre-release
Pre-release
Added
- A "Launch at login" option in Settings → Configuration (#504)
hs.onShutdown, called with"reload"or"quit"just before your config is torn down (replacing Hammerspoon 1'shs.shutdownCallback)hs.hostinfo, withcpuUsage(),cpuCoreUsage(),memoryUsage(),swapUsage(),loadAverage(),memoryPressure()and amemoryPressureevent, for monitoring how busy your Mac ishs.keychain, for storing passwords, tokens and other secrets in the macOS keychain instead of your config files (#507)hs.eventkit, for listing and searching calendar events, including their location and notes (e.g. to find Zoom or Teams links) (#492)hs.speech, for speaking text aloud with the system's voices, queueing and interrupting speech, and sending announcements to VoiceOverhs.appinfo.versionAtLeast(), which checks that Hammerspoon 2 is at least a given version, ordering prereleases correctly (1.0.0-beta.9<1.0.0-beta.10<1.0.0) (#491)- An optional
minimumHSVersionin a Spoon'sspoon.json;hs.spoons.load()refuses to load the Spoon on an older Hammerspoon 2, with the error codeEVERSION(#491) hs.accessibilityTimeout, to choose how long Accessibility requests wait for an application to answer (#494)hs.axwatchers can watch Hammerspoon's own application and windows for window notifications (created, focused, moved, resized, minimized, retitled, destroyed) (#505)- The API docs list the object types a module's methods take and return, such as
HSMenuItemandHSCanvasElement, on the module's page (#511) hs.httpserver'ssetTLSFromKeychain(), to serve HTTPS with an identity from the keychainhs.mqtt'sclientCertificateoption accepts"keychain:<name>", for a client identity from the keychainHSAXElement.setAttributeValue()can set the selection or caret position withAXSelectedTextRangeandAXSelectedTextRangesHSAXElement.parameterizedAttributeNames()andHSAXElement.parameterizedAttributeValue(), for attributes such asAXStringForRangeandAXBoundsForRangethat take a parameterhs.pasteboard.readBytes(),hs.pasteboard.writeBytes(),hs.pasteboard.readItems(), andhs.pasteboard.writeItems()for binary and multi-item clipboard access (#513)HSImage.fromUint8Array(), which decodes an image directly from aUint8Array, typed array, orArrayBufferwithout going through the disk (#513)hs.pasteboard.readURLs()andhs.pasteboard.writeURLs()for reading and writing multiple URLs (including Finder file copies) with proper macOS file URL resolution and sandbox extensions (#513)hs.hostinfo.interfaceStyle(), which returns"light"or"dark", andhs.hostinfo.on("interfaceStyle", ...)to be told when macOS switches between them (#538)
Changed
HSEventTapEvent.typeis nowcode, and the newnameproperty gives the event's name fromhs.eventtap.eventTypes(e.g."keyDown")hs.appinfo.cpuCountandhs.appinfo.ramAmounthave moved tohs.hostinfo.cpuCountandhs.hostinfo.ramAmounths.canvaswindows that aren't click-activating can now appear over fullscreen applications, even while Hammerspoon shows a Dock icon (#505)hs.canvaswindows report an accessibility subrole ending in.Hammerspoonby default, andsetAccessibilitySubrole()now changes the subrole other applications see (""restores the default) (#505)hs.windowfilternow includes Hammerspoon's own windows (such as the Console), judged by a filter's rules like any other application's;hs.canvaswindows are still left out by the default roles (#505)- The TypeScript definitions now describe the fields of the objects APIs take and return, such as
hs.power.batteryInfo(), menu items, chooser choices andhs.canvaselements, instead of typing themRecord<string, any>(#511) - In the API docs, type names link to their documentation, and object types appear in search (#511)
hs.socket'senableServerTLSFromKeychain()andhs.mqtt'scaCertificate: "keychain:<name>"look for certificates stored withhs.keychainfirsths.pasteboard.writeObjects()now acceptsUint8Array, typed arrays, andArrayBuffervalues in addition to strings (#513)hs.pasteboard.readURL()resolves Finder file-reference URLs (file:///.file/id=...) to file paths (#513)hs.window.orderedWindows()only includes windows on the visible Space(s), like Hammerspoon 1; usehs.window.allWindows()for minimized windows and windows on other Spaces (#537)
Fixed
hs.task.runAsync()now rejects, and anhs.task.create()termination callback is now called with reason"launchFailed", when the program can't be started (e.g. it doesn't exist), instead of never finishing (#489)hs.window'sfocus()no longer brings forward the application's last used window on another display (#490)hs.windowfilterno longer leaves out the windows of an application that was hidden and then unhidden, when a filter only allows some window subroles (e.g.allowRoles: "AXStandardWindow") (#493)hs.windowfiltercould wait up to ~6 seconds for a hung application while starting up, instead of 0.25 seconds (#494)hs.windowfilternotices windows and applications that went away without macOS saying so, within a minute, and reports them as destroyed (#495)hs.windowfilterrules withallowRolesno longer reject standard windows while they're minimized or their application is hidden, which macOS reports asAXDialog(#501)win.isStandardis no longer false for minimized windows, or those of hidden applications, that can be minimized (#501)hs.canvasclickActivating(false)now stops clicks on a canvas from activating Hammerspoon (#505)hs.windowfilter'sisWindowAllowed()no longer allows Hammerspoon's own windows (#505)hs.window.forID()now finds minimized windows and windows of hidden applications, instead of returningnull(#506)hs.window'sfocus()gives the keyboard focus to the requested window again in apps such as Google Chrome, rather than to the app's last used window (#512)- hs.mqtt explains TLS failures, such as the broker rejecting the client certificate or not being trusted, instead of reporting a raw error code or "Broken pipe" (#517)
hs.notify.create()'scallbackis now called when the user clicks the notification or one of its actions (#516)hs.httpserver'ssetTLSFromPKCS12()andhs.mqtt'sclientCertificateno longer add the certificate and private key to your login keychainhs.httpserverno longer serves plain HTTP when the identity given tosetTLSFromPKCS12()orsetTLSFromKeychain()can't be loaded, it doesn't start insteadhs.application.runningApplications()andhs.application.matchingName()no longer include Hammerspoon 2's ownhs.osascripthelper, which never answershs.axrequests and made loops over running apps wait out the Accessibility timeoutHSAXElement.attributeValue()returns range attributes such asAXSelectedTextRangeas{location, length}objects instead of empty objects- TypeScript definitions now mark optional parameters as optional, e.g.
hs.task.runAsync(path, args)andhs.fs.volumes()no longer need every argument (#532) - TypeScript definitions now compile in TypeScript 7, which rejected the declaration of
hs.appinfo.arguments(#532) hs.window.orderedWindows()now returns the windows on screen front to back, rather than grouped by application, sohs.window.frontmostWindow()also returns the window in front when no window has focus (#537)
Full Changelog: 1.0.0-beta.4...1.0.0-beta.5