Skip to content

Hammerspoon 2 0.0.17

Choose a tag to compare

@cmsj cmsj released this 15 Nov 17:58
· 45 commits to main since this release

Added

  • HSMenuBarItem.titleColor, to colour a menu bar item's title (#354)
  • A color key for hs.menubar and hs.dockicon menu entries, to colour their titles (#354)
  • hs.bluetooth, for listing paired and connected Bluetooth devices, their battery levels, connecting and disconnecting them, scanning for nearby devices, reading and writing Bluetooth LE characteristics, and watching for connections and Bluetooth being turned on or off (#357)
  • hs.permissions.checkBluetooth() and hs.permissions.requestBluetooth() (#357)
  • Hammerspoon 2 can now request access to calendars and reminders, so scripts can read them via EventKit (e.g. JXA in hs.osascript, or tools run with hs.task) (#362)
  • HSUIWindow.behavior() and HSUIWindow.behaviorList(), to make a window appear on every Space or over fullscreen apps (e.g. behaviorList(["canJoinAllSpaces", "fullScreenAuxiliary"])) (#364)
  • hs.chooser now supports Page Up / Page Down (or Fn-↑ / Fn-↓) to move through results a page at a time, and Home / End (or Fn-← / Fn-→) to jump to the first / last result (#369)
  • hs.wifi.configuration() and hs.wifi.cachedScanResults(), which return the configuration and cached scan results that used to be part of hs.wifi.interfaceDetails() (#370)
  • hs.spoons.use(), which installs a Spoon from a GitHub repository or zip URL if it isn't installed, then loads and configures it, like v1's SpoonInstall (#372)
  • hs.spoons.install(), hs.spoons.update(), hs.spoons.uninstall(), hs.spoons.available() and hs.spoons.installed(), for managing Spoons from GitHub repositories or zip URLs (#372)
  • An "Install Spoons when opened" setting in the Advanced settings tab that turns off automatic installation of double-clicked .spoon2 bundles (#373)
  • hs.chooser choices can opt out of the context menu with contextMenu: false
  • hs.socket, for communicating over raw TCP, UDP and Unix domain sockets
  • HSSocket.enableServerTLS() and HSSocket.enableServerTLSFromKeychain(), which make a listening socket use TLS with a certificate from a PKCS#12 file or the keychain
  • HSSocket.listen() and HSUDPSocket.bind() take an optional local IP address, to accept connections or datagrams on just that address
  • HSSocket.state, HSSocket.connectTimeout and HSSocket.readTimeout, and an optional lossy argument to hs.socket.decodeText()
  • hs.mqtt, an MQTT client for publishing and subscribing to brokers
  • Hammerspoon 2 offers to report a crash as a GitHub issue the next time it launches

Changed

  • HSUIWindow.level() and HSUIWindow.windowTitle() now update a window that's already shown (#364)
  • hs.wifi.interfaceDetails() no longer includes configuration or cachedScanResults, because fetching them leaks memory inside macOS. Use hs.wifi.configuration() and hs.wifi.cachedScanResults() instead (#370)
  • hs.loadSpoon() is now hs.spoons.load(), and its errors have a code (#372)
  • Console results are now formatted like console.log() output (e.g. booleans print as true/false, objects as { a: 1 }) (#378)
  • hs.chooser context menus are now set once for the whole chooser with contextMenu, and report the picked entry and row to a single onContextMenuSelect callback, instead of each choice having its own contextMenu with an action per entry

Fixed

  • HSWindow.isFocused now returns true for the focused window (#358)
  • console.log() of Hammerspoon objects (e.g. an HSApplication) printed undefined {} instead of a description of the object (#359)
  • hs.window:focus() now keeps the requested window in front in applications such as Google Chrome that bring their previous window back after activating (#361)
  • HSCanvas.behaviorList() and HSCanvas.behaviorValue() no longer crash Hammerspoon when given mutually exclusive behaviors (e.g. canJoinAllSpaces with moveToActiveSpace) or a negative bitmask; they throw an Error instead (#364)
  • Reloading the configuration no longer leaks the previous JavaScript environment's memory if fetch() was used (#366)
  • Polling hs.wifi.interfaceDetails() no longer makes Hammerspoon's memory use grow steadily (#370)
  • Errors in Promises that nothing handles, such as a Spoon that fails to load in hs.spoons.use(), are now logged to the Console instead of disappearing (#372)
  • Hammerspoon could freeze when updating an hs.chooser's choices while its callbacks were being garbage collected (#376)
  • hs.timer.doAt() now repeats at repeatInterval instead of only firing once

Full Changelog: 0.0.16...0.0.17