hammerspoon

HammerspoonMIT更新放缓

用 Lua 脚本把 macOS 的窗口管理、快捷键、应用联动等操作串起来,实现桌面自动化,省去重复的手动点击和切换。

Staggeringly powerful macOS desktop automation with Lua

1.1.1发布于 2026-02-26 10:52 UTC16,403star +14 / 7 天737fork同步于 2026-11-10 17:25 UTC

怎么上手

由 README 提炼,执行前请确认
brew install hammerspoon --cask
硬件要求按 README 说明

README 未说明,仅要求 macOS 系统

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Lua 脚本桥接 macOS 系统 API,实现桌面自动化

用 Lua 脚本把 macOS 的窗口管理、快捷键、应用联动等操作串起来,实现桌面自动化,省去重复的手动点击和切换。

核心能力

  • 以 Lua 脚本引擎桥接操作系统 API
  • 通过扩展模块暴露具体系统功能
  • 可编写脚本控制 macOS 环境各方面
  • 支持 Homebrew 或手动安装应用

容易踩的坑

安装后默认不做任何事,需自行创建 ~/.hammerspoon/init.lua 并写入配置代码

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本1.1.1
  1. 1.1.1最新正式版2026-02-26 · 2026-02-26 10:52 UTC

    layout: post title: 1.1.1 permalink: /releasenotes/1.1.1.html

    Minimum macOS version: 13.0

    Fixed

    • Download archive of Hammerspoon should no longer contain spurious resource forks that can confuse macOS Gatekeeper
  2. 1.1.02025-12-24 · 2025-12-24 11:16 UTC
    查看更新说明

    Fixed

    • Validate that all arguments provided for an hs.task, are strings #3664
    • Fixes for Xcode 16 #3690
    • hs.urlevent callback parameters are now lowercase #3691
    • Fix package.paths under userruntime w/ unexpanded tilde #3703
    • Fixed websocket support in hs.httpserver:start() #3665
    • hs.ipc: Avoid reentrance when in printReplacement #3718
    • Fix Lua stack corruption in window:application() when process terminated #3827
    • Reuse [statusItem menu] if possible (fixes #1923) #3812
    • The window_filter event handler might receive an invalid pid #3814
    • hs.mouse - fixes setMouseSpeed and adds trackpad support #3758

    Added

    • Lua skin additions #3667
    • Add NSUserActivityTypeBrowsingWeb handling #3635
    • Support creation of smart magnify events #3679
    • Add hs.audiodevice:thru() and hs.audiodevice:setThru(thru) #3716
    • Improve window move and resize by managing AXEnhancedUserInterface attribute #3836
    • hs.mouse - fixes setMouseSpeed and adds trackpad support #3758

    Other

    • window_filter: track applications by PID #3745
    • Fixed Stream Deck Mini Button 1 Callback Trigger #3767
    • Update copyrights. #3804
    • Actually create a proper PR for build fixes #3834
    • Fix typo in logger's documentation #3778
  3. 1.0.02024-08-06 · 2024-08-06 02:46 UTC
    查看更新说明

    Fixed

    • [READY] hs.battery -- Fix for systems that report an empty array for powerSources #3449
    • add exit call to fix empty space issue #3465 #3466
    • Include docs.css in build for built in web help #3476
    • fix attempt to index a nil value (local 'child') #3481 #3485
    • Fix hs.network.ping to always call didFinish callback #3531
    • Allow passing nil as name to hs.pasteboard.callbackWhenChanged #3616
    • [Review] Fix moving window to space in Sonoma 14.5 #3638
    • Improve Console window performance and RAM usage #3659

    Changed

    • Fix blockAlert documentation #3484
    • Rewrite of hs.hash to simplify adding new hashes #3483

    Added

    • [Ready] hs.watchable -- added alwaysNotify to watcher #3440
    • Update alert.lua: allow window object as parameter #3542
    • Add getCurrentTrackArtworkURL() to spotify extension #3546
    • Added new Stream Deck XL PID #3570
    • Pass in fullURL to url event callback handler #3640
    • Improve preferences resetting dialog #3657
    • Update Lua to 5.4.7 #3658

    Other

    • fix(ci): Manage secrets/permissions #3396
  4. 0.9.1002023-03-14 · 2023-03-14 17:52 UTC
    查看更新说明

    layout: post title: 0.9.100 permalink: /releasenotes/0.9.100.html

    Fixed

    • None

    Changed

    • None

    Added

    • hs.hash now has binary-preserving variants of MD5/SHA1/SHA256/SHA512 (where the existing functions encode the hash to a hex string). These functions have been added to support the new OBS Spoon
  5. 0.9.992023-03-13 · 2023-03-13 14:59 UTC
    查看更新说明

    Fixed

    • Revert SocketRocket pod update. Closes #3422 #3424
    • Fix hs.application.get() interpreting Lua patterns #3425

    Other

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Hammerspoon

    CI codecov.io Downloads current release Downloads all releases Latest tag Latest release

    Discord: Click to join

    What is Hammerspoon?

    This is a tool for powerful automation of OS X. At its core, Hammerspoon is just a bridge between the operating system and a Lua scripting engine.

    What gives Hammerspoon its power is a set of extensions that expose specific pieces of system functionality, to the user. With these, you can write Lua scripts to control many aspects of your OS X environment.

    How do I install it?

    Manually

    • Download the latest release
    • Drag Hammerspoon.app from your Downloads folder to Applications

    Homebrew

    • brew install hammerspoon --cask

    What next?

    Out of the box, Hammerspoon does nothing - you will need to create ~/.hammerspoon/init.lua and fill it with useful code. There are several resources which can help you:

    What is the history of the project?

    Hammerspoon is a fork of Mjolnir. Mjolnir aims to be a very minimal application, with its extensions hosted externally and managed using a Lua package manager. We wanted to provide a more integrated experience.

    What is the future of the project?

    Our intentions for Hammerspoon broadly fall into these categories:

    • Ever wider coverage of system APIs in Extensions
    • Tighter integration between extensions
    • Smoother user experience