github Hammerspoon/Hammerspoon2 1.0.0-beta.5
Hammerspoon 2 1.0.0 Beta 5

pre-release2 hours ago

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's hs.shutdownCallback)
  • hs.hostinfo, with cpuUsage(), cpuCoreUsage(), memoryUsage(), swapUsage(), loadAverage(), memoryPressure() and a memoryPressure event, for monitoring how busy your Mac is
  • hs.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 VoiceOver
  • hs.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 minimumHSVersion in a Spoon's spoon.json; hs.spoons.load() refuses to load the Spoon on an older Hammerspoon 2, with the error code EVERSION (#491)
  • hs.accessibilityTimeout, to choose how long Accessibility requests wait for an application to answer (#494)
  • hs.ax watchers 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 HSMenuItem and HSCanvasElement, on the module's page (#511)
  • hs.httpserver's setTLSFromKeychain(), to serve HTTPS with an identity from the keychain
  • hs.mqtt's clientCertificate option accepts "keychain:<name>", for a client identity from the keychain
  • HSAXElement.setAttributeValue() can set the selection or caret position with AXSelectedTextRange and AXSelectedTextRanges
  • HSAXElement.parameterizedAttributeNames() and HSAXElement.parameterizedAttributeValue(), for attributes such as AXStringForRange and AXBoundsForRange that take a parameter
  • hs.pasteboard.readBytes(), hs.pasteboard.writeBytes(), hs.pasteboard.readItems(), and hs.pasteboard.writeItems() for binary and multi-item clipboard access (#513)
  • HSImage.fromUint8Array(), which decodes an image directly from a Uint8Array, typed array, or ArrayBuffer without going through the disk (#513)
  • hs.pasteboard.readURLs() and hs.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", and hs.hostinfo.on("interfaceStyle", ...) to be told when macOS switches between them (#538)

Changed

  • HSEventTapEvent.type is now code, and the new name property gives the event's name from hs.eventtap.eventTypes (e.g. "keyDown")
  • hs.appinfo.cpuCount and hs.appinfo.ramAmount have moved to hs.hostinfo.cpuCount and hs.hostinfo.ramAmount
  • hs.canvas windows that aren't click-activating can now appear over fullscreen applications, even while Hammerspoon shows a Dock icon (#505)
  • hs.canvas windows report an accessibility subrole ending in .Hammerspoon by default, and setAccessibilitySubrole() now changes the subrole other applications see ("" restores the default) (#505)
  • hs.windowfilter now includes Hammerspoon's own windows (such as the Console), judged by a filter's rules like any other application's; hs.canvas windows 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 and hs.canvas elements, instead of typing them Record<string, any> (#511)
  • In the API docs, type names link to their documentation, and object types appear in search (#511)
  • hs.socket's enableServerTLSFromKeychain() and hs.mqtt's caCertificate: "keychain:<name>" look for certificates stored with hs.keychain first
  • hs.pasteboard.writeObjects() now accepts Uint8Array, typed arrays, and ArrayBuffer values 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; use hs.window.allWindows() for minimized windows and windows on other Spaces (#537)

Fixed

  • hs.task.runAsync() now rejects, and an hs.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's focus() no longer brings forward the application's last used window on another display (#490)
  • hs.windowfilter no 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.windowfilter could wait up to ~6 seconds for a hung application while starting up, instead of 0.25 seconds (#494)
  • hs.windowfilter notices windows and applications that went away without macOS saying so, within a minute, and reports them as destroyed (#495)
  • hs.windowfilter rules with allowRoles no longer reject standard windows while they're minimized or their application is hidden, which macOS reports as AXDialog (#501)
  • win.isStandard is no longer false for minimized windows, or those of hidden applications, that can be minimized (#501)
  • hs.canvas clickActivating(false) now stops clicks on a canvas from activating Hammerspoon (#505)
  • hs.windowfilter's isWindowAllowed() no longer allows Hammerspoon's own windows (#505)
  • hs.window.forID() now finds minimized windows and windows of hidden applications, instead of returning null (#506)
  • hs.window's focus() 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()'s callback is now called when the user clicks the notification or one of its actions (#516)
  • hs.httpserver's setTLSFromPKCS12() and hs.mqtt's clientCertificate no longer add the certificate and private key to your login keychain
  • hs.httpserver no longer serves plain HTTP when the identity given to setTLSFromPKCS12() or setTLSFromKeychain() can't be loaded, it doesn't start instead
  • hs.application.runningApplications() and hs.application.matchingName() no longer include Hammerspoon 2's own hs.osascript helper, which never answers hs.ax requests and made loops over running apps wait out the Accessibility timeout
  • HSAXElement.attributeValue() returns range attributes such as AXSelectedTextRange as {location, length} objects instead of empty objects
  • TypeScript definitions now mark optional parameters as optional, e.g. hs.task.runAsync(path, args) and hs.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, so hs.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

Don't miss a new Hammerspoon2 release

NewReleases is sending notifications on new releases.