安装后默认不做任何事,需自行创建 ~/.hammerspoon/init.lua 并写入配置代码
brew install hammerspoon --caskREADME 未说明,仅要求 macOS 系统
用 Lua 脚本桥接 macOS 系统 API,实现桌面自动化
用 Lua 脚本把 macOS 的窗口管理、快捷键、应用联动等操作串起来,实现桌面自动化,省去重复的手动点击和切换。
核心能力
- 以 Lua 脚本引擎桥接操作系统 API
- 通过扩展模块暴露具体系统功能
- 可编写脚本控制 macOS 环境各方面
- 支持 Homebrew 或手动安装应用
容易踩的坑
- 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
- 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 underuserruntimew/ 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
- 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
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
fullURLto url event callback handler #3640 - Improve preferences resetting dialog #3657
- Update Lua to 5.4.7 #3658
Other
- fix(ci): Manage secrets/permissions #3396
- 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
- 0.9.992023-03-13 · 2023-03-13 14:59 UTC
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Hammerspoon
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.appfrom yourDownloadsfolder toApplications
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:
- Getting Started Guide
- API docs
- FAQ
- Sample Configurations supplied by various users
- Contribution Guide for developers looking to get involved
- An IRC channel for general chat/support/development (#hammerspoon on Libera)
- Google Group for support
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