Native macOS battery monitor tray app with low-battery alerts, settings, and keyboard shortcut.
- macOS on Apple silicon (arm64, M1/M2+)
- Intel Macs are not supported
- macOS tray app showing battery percentage with low-battery alerts
- Toggle notifications from tray or keyboard (
Ctrl+Alt+N) - Loop interval:
0= single alert,>0= repeating alerts - Tray title/tooltip indicate status and next-alert countdown
- Settings: threshold (%), loop interval (s), launch at login, notify on AC
- Battery status via Electron
powerMonitorwithpmsetfallback on macOS - Robust error logging with global handlers
- Security policies: sandboxed, blocked
window.open, denied navigation, isolated preload
This app focuses on tray-based battery monitoring and notifications using Electron-only APIs. Native daemon integration has been removed.
Notifications are controlled via the tray menu and keyboard shortcut, not via a master toggle in the settings panel. The only notification-related configuration in Settings is the loop interval (seconds) used for repeating alerts when the threshold is met.
Notification Loop Behavior:
- Interval = 0: A single notification is shown when the threshold is met; no repeat is scheduled.
- Interval > 0: Notifications repeat at the configured interval until disabled or the condition no longer holds.
Dynamic Interval Updates:
- Changing the loop interval in Settings immediately reconfigures the notification loop without restart.
- The existing loop is safely cleaned up and a new schedule starts with the updated interval.
Keyboard Shortcut:
- Press
Ctrl+Alt+Nto toggle notifications on/off. The tray title shows🔔when enabled and🔕when disabled.
Settings Overview:
- Notification threshold (%) — slider at top of Settings
- Loop interval (seconds) — integer 0–3600
- Launch at startup — macOS login item
- Notify when charging — deliver alerts even when on AC power
Assets:
- App icon: place
assets/icon.icnsand set inpackage.jsonbuild.mac.icon. - Tray icon:
assets/trayTemplate.png(monochrome template image, tinted by macOS).- Generate
.icnsfrom a base PNG usingsipsandiconutil:mkdir -p assets/AppIcon.iconset- Resize with
sipsto standard sizes, then:iconutil -c icns assets/AppIcon.iconset -o assets/icon.icns
- Generate
npm install
npm startnpm run buildnpm run test:notify -- 50This triggers a notification if your battery is on battery power and <= 50%.
npm run test:unitRuns basic tests for interval clamping and single vs loop behavior.