Lightweight Hammerspoon scripts that add real-time system indicators to the macOS menu bar.
Includes 🪫 Low Battery Alert and 🔥 High CPU Usage monitors, both designed for ultra-low overhead and instant responsiveness using native ioreg and shell integrations.
- Displays a 🪫 icon in the menu bar when battery < 10 %.
- Shows a persistent alert if battery < 3 %.
- Automatically disappears when power is connected.
- Uses direct
ioregreads for instant detection — no delay or caching. - Optional lightweight polling (only active under 10 %).
- Monitors the top CPU process every 1 minute.
- Displays a 🔥 menu bar icon if any process exceeds 100 % CPU.
- Tooltip shows the exact process name and CPU percentage.
- Hides itself automatically when usage normalizes.
Both scripts are self-contained, event-driven, and consume < 0.1 % CPU total. Each utility is intentionally small, single-purpose, and can be combined in any configuration.
- macOS with Hammerspoon installed
- Hammerspoon accessibility access granted (required for menu bar and alerts)
- Hammerspoon Preferences → Behavior → enable Launch Hammerspoon at login
- Hammerspoon allowed in the menu bar:
System Settings → Control Center → Menu Bar → Allow in the Menu Bar

- Optional: In Hammerspoon Preferences → Behavior, uncheck Show menu icon for a cleaner menu bar

git clone https://github.com/marksowell/hammerspoon-menu-bar.gitcp battery.lua cpu.lua ~/.hammerspoon/Edit your ~/.hammerspoon/init.lua:
require("battery")
require("cpu")Reload your config (⌘ + ⌃ + R) or restart Hammerspoon.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.