Hammerspoon
Back to System
HammerspoonBeginner9 min

Hammerspoon Menu Bar Customization: Build Your Own Status Indicators

Custom Menu Bar Basics

Create custom menu bar items in Hammerspoon — show battery, network, or any shell output as live status indicators written in Lua.

Hammerspoon bridges macOS internals to Lua. You get window management, clipboard, automation triggers, and system events — all scriptable.

By the end of this 9 min guide, you'll have a working Hammerspoon setup and practical Hammerspoon workflows you can use immediately.

Setting Up hs.menubar in init.lua

Install Hammerspoon:

brew install --cask hammerspoon
Tip: Verify the installation with hammerspoon --version or hammerspoon -V after installing.

Building Status Indicators

Your init.lua is the entry point. Split large configs into modules under lua/ and require them. Set hs.window.animationDuration = 0 for instant snapping.

Here's a foundational configuration to start with:

-- init.lua
hs.window.animationDuration = 0
hs.hotkey.bind({"cmd","alt"}, "left", function()
local f = hs.window.focusedWindow():frame()
local s = hs.window.focusedWindow():screen():frame()
f.x, f.y, f.w, f.h = s.x, s.y, s.w/2, s.h
hs.window.focusedWindow():setFrame(f)
end)

Auto-Updating Widgets

With Hammerspoon configured, these Hammerspoon-specific workflows will save you time every day:

Pro tip: Don't try to adopt everything at once. Start with Cmd+Alt+Arrows snap windows to halves and add more as it becomes habit.

Click Actions & Dropdown Menus

Once you're comfortable with Hammerspoon basics, these advanced techniques will transform your Hammerspoon workflow:

Menu Bar Rendering Issues

Here are the most common Hammerspoon issues and how to fix them:

Menu Bar Mastery

Congratulations — you now have a solid Hammerspoon foundation. Here's where to go next:

← PreviousRaycast Window Management: Snap, Tile, and Switch Like a ProNext →Hammerspoon Clipboard Manager: A Lua-Powered History Tool