Never let your controller die mid-game.
Native macOS menu bar battery monitor & accessory low-battery HUD for PlayStation DualSense, Xbox, Nintendo Switch, and MFi controllers.
Note
AI-Generated Project Disclosure LifeBar (including its Swift architecture, GameController framework observation, AppKit non-activating HUD panel, reverse-engineered macOS accessory battery notification layout, and Apple HIG dark mode squircle icon) is an AI-generated project created with Antigravity (Google DeepMind).
macOS displays a brief system pill banner when a game controller connects via Bluetooth, but it provides no persistent menu bar battery monitor and never alerts you when your controller battery drops dangerously low during a game.
To check your battery level, you usually have to leave your game, open System Settings, navigate to the Game Controllers pane, and squint at the subline. When the battery runs out, the controller simply shuts off mid-action without warning—costing you a boss fight or clutch multiplayer round.
LifeBar solves this with pure macOS first-party polish:
- Instant Menu Bar Glanceability: Sits quietly in your menu bar using Apple's official SF Symbol
gamecontrollerglyph, with optional live percentage display and zero Dock clutter (LSUIElement). - macOS System Settings Aesthetics: Pops open a clean, native card list matching macOS Sequoia/Sonoma System Settings, featuring branded PlayStation, Xbox, and Nintendo squircle badges.
- Apple Accessory Low-Battery HUD Notification: Recreates Apple's exact floating frosted-glass accessory low-battery pill banner (with circular gauge, red progress arc, and alert sound) whenever your controller drops to 20% (or your chosen threshold).
- Uses Apple's official SF Symbol
gamecontrollerglyph with automatic Dark/Light menu bar template adaptation. - Highlights with macOS's native accent selection pill while the menu is open (
NSPopoverDelegate). - Runs as a lightweight macOS agent app (
LSUIElement = true) with 0% background CPU overhead. - Optional toggle to display the battery percentage directly in the menu bar next to the icon.
- Hover tooltip showing all connected controllers and their individual battery percentages.
- Uses Apple's
GameController.framework(GCController) for reliable detection of wireless (Bluetooth) and wired game controllers:- Sony PlayStation: DualSense, DualSense Edge, DualShock 4 (branded Sony Blue squircle with
playstation.logo). - Microsoft Xbox: Xbox Wireless Controller, Xbox Elite Series 2 (branded Xbox Green squircle with
xbox.logo). - Nintendo: Switch Pro Controller, Joy-Cons (branded Nintendo Red squircle).
- MFi & HID Gamepads: 8BitDo, Backbone One, Razer, SteelSeries, etc.
- Sony PlayStation: DualSense, DualSense Edge, DualShock 4 (branded Sony Blue squircle with
- Displays connection status, live battery level, charging indicators (
⚡️ Battery 55% (Charging)), and visual progress badges.
- Recreates Apple's native accessory low-battery pill alert:
- Floating Frosted Capsule: Borderless, non-activating
NSPanelfloating smoothly at the top of your screen below the notch/menu bar. - Built-in Controller Glyph: Uses Apple's official 3D controller asset (
Generic-GameController.pngfromCoreBluetoothUI). - Apple Circular Gauge Ring: Circular track, remaining battery arc in red, and centered battery percentage number in SF Pro Rounded.
- Audio & System Integration: Accompanied by macOS alert sound (
Sosumi) and mirrored to macOS Notification Center.
- Floating Frosted Capsule: Borderless, non-activating
- Smart Deduplication: Alerts once per discharge cycle; will not spam repeatedly while in the low-battery state.
- One-Click Test: Includes a "Test Low Battery Notification" button to preview the exact HUD alert anytime.
- Battery Health-Style Threshold Slider: Smoothly adjust your preferred alert threshold using an Apple Battery Health-style slider (5% to 35% in 5% increments) with a live percentage indicator badge.
- Quick Settings Access: One-click shortcut jumping directly to the macOS Game Controllers settings pane.
- Launch at Login: Native integration with Apple's modern
SMAppServiceAPI. - Sleep & Wake Resilient: Automatically refreshes connections and polling upon system wake.
- Download the App:
Go to the Releases page and download
LifeBar-v1.1.0.dmg(orLifeBar-v1.1.0.zip). - Move to Applications:
Open the disk image and drag
LifeBar.appdirectly into your/Applicationsfolder. - First-Launch Gatekeeper Clearance (macOS):
Because the app is ad-hoc signed, run the following command once in Terminal (or right-click -> Open in Finder) to clear the macOS quarantine attribute:
xattr -cr /Applications/LifeBar.app
- Launch & Connect:
- Open
LifeBarfrom Applications, Spotlight, or Launchpad. - Pair or turn on your game controller — the battery level will appear instantly in your menu bar!
- Open
LifeBar/
├── Package.swift # Swift package definition (macOS 13+)
├── Info.plist # Bundle configuration (LSUIElement = true)
├── Makefile # Convenient build & install targets
├── build.sh # Release packaging & ad-hoc codesigning script
├── generate_icns.sh # Multi-resolution Retina AppIcon compiler
├── assets/
│ └── icon.png # macOS Sequoia Dark Mode vector app icon
└── Sources/
└── LifeBar/
├── main.swift # Main entry point & NSApplication lifecycle
├── AppDelegate.swift # NSStatusItem & NSPopover coordinator
├── ControllerManager.swift # GameController observation & battery monitoring
├── ControllerModel.swift # Brand detection, SF Symbols & battery formatting
├── MenuView.swift # SwiftUI popover matching System Settings
├── LowBatteryHUDController.swift # Floating NSPanel HUD presentation & animation
└── LowBatteryHUDView.swift # Frosted glass capsule & circular gauge view
GCControllerLifecycle: Listens to.GCControllerDidConnectand.GCControllerDidDisconnectnotifications, coupled with low-frequency (6s) battery polling that incurs zero perceptible system load.- Non-Activating HUD Window:
LowBatteryHUDControllermanages anNSPanelwith.nonactivatingPaneland collection behavior[.canJoinAllSpaces, .fullScreenAuxiliary], ensuring full-screen games never lose focus when the low-battery warning appears.
Ensure you have Xcode Command Line Tools and Swift 5.9+ installed:
# Clone the repository
git clone https://github.com/passs0/LifeBar.git
cd LifeBar
# Build the release app bundle
make app
# Run the app
make run
# Install to /Applications
make installThis project is licensed under the MIT License.

