A lightweight macOS menu bar application that monitors your battery level and provides visual alerts when battery charge reaches customizable thresholds.
Grapes is a battery observer app designed for macOS that runs quietly in the menu bar and alerts you when your battery level is too low (needs charging) or too high (should be unplugged). The app features beautiful sliding overlay animations with customizable threshold settings to help you maintain optimal battery health.
- Menu Bar Integration: Runs as a lightweight menu bar app with battery icon indicator
- Customizable Thresholds: Set your own low and high battery percentage alerts
- Default low threshold: 20%
- Default high threshold: 80%
- Visual Alerts: Beautiful full-screen sliding overlay animations that show:
- Current battery percentage
- Color-coded indicators (red for low, green for high)
- Action prompts ("Plug in!" or "Enough!")
- Smart Notifications:
- Monitors battery every 20 seconds
- Alerts only once per threshold crossing
- Auto-dismisses after 3 seconds or click to dismiss instantly
- Toggle Alerts: Easily enable or disable alerts from the menu bar
- Auto-start at Login: Automatically starts with macOS (macOS Ventura 13.0+)
- Blur Effect: Elegant blurred background overlay with smooth animations
- macOS 13.0 (Ventura) or later
- Xcode 15.0 or later (for building from source)
-
Clone the repository:
git clone https://github.com/Harshul23/Grapes.git cd Grapes -
Open the project in Xcode:
open Grapes.xcodeproj
Or simply double-click
Grapes.xcodeprojin Finder. -
Build and run the project:
- Select the "Grapes" scheme in Xcode
- Press ⌘ + R to build and run
- Or use Product → Run from the menu
-
The app will appear in your menu bar with a battery icon once running
Note: The project requires Xcode 15.0+ with macOS deployment target of 13.0 (Ventura) or later.
- Open
Grapes.xcodeprojin Xcode 15+ on your Mac. - In the project navigator, select the Grapes target → Signing & Capabilities. Pick your Apple ID/team so the app can be signed for local builds (Automatic signing is enabled in the project).
- In Build Settings, confirm macOS Deployment Target is set to 13.0 or later. This value is configured in the project file so the app runs on Ventura (13), Sonoma (14), and Sequoia (15.6.1).
- Choose the My Mac (Designed for macOS) destination and press ⌘R to build and run. No additional entitlements are required beyond the sandbox already enabled in the target.
Once launched, Grapes runs in the background and appears as a battery icon in your macOS menu bar.
Click the battery icon in the menu bar to access:
- Preferences…: Open settings to customize battery thresholds
- Enable/Disable Alerts: Toggle battery alerts on or off
- Quit: Exit the application
- Click the battery icon in the menu bar
- Select "Preferences…" (or press
⌘ + ,) - Adjust the sliders:
- High Battery Threshold: Set between 50% - 100% (when to alert for unplugging)
- Low Battery Threshold: Set between 5% - 50% (when to alert for charging)
- Values are automatically saved and take effect immediately
-
Triggers when battery drops to or below your low threshold
-
Shows red sliding bar animation
-
Displays current percentage and "Plug in!" message
-
Suggests you should charge your device
-
Triggers when battery reaches or exceeds your high threshold
-
Shows green sliding bar animation
-
Displays current percentage and "Enough!" message
-
Suggests you should unplug your device
Alerts automatically dismiss after 3 seconds, or you can:
- Click anywhere on the overlay to dismiss immediately
Grapes/
├── Grapes.xcodeproj/ # Xcode project file
│ ├── project.pbxproj # Project configuration
│ └── xcshareddata/ # Shared schemes
│ └── xcschemes/
│ └── Grapes.xcscheme
├── Grapes/ # Source code directory
│ ├── main.swift # Application entry point
│ ├── AppDelegate.swift # Main application logic
│ └── Assets.xcassets/ # App icons and resources
└── README.md
The app is built with native macOS technologies:
- Cocoa Framework: For macOS app development
- IOKit: For battery status monitoring via
IOPSCopyPowerSourcesInfo() - QuartzCore: For smooth animations
- ServiceManagement: For auto-start at login functionality
Entry point that initializes the NSApplication and sets up the AppDelegate.
Main application logic including:
- Menu bar setup and management
- Battery monitoring timer (checks every 20 seconds)
- Alert threshold management with UserDefaults persistence
- Sliding overlay UI with blur effects
- Preferences window with real-time slider updates
The app uses IOKit to access battery information:
- Reads current capacity and maximum capacity
- Calculates percentage level
- Compares against user-defined thresholds
- Triggers alerts only on threshold crossings (not continuously)
User preferences are stored using UserDefaults:
lowThreshold: Low battery alert percentage (default: 20)highThreshold: High battery alert percentage (default: 80)
Optimal battery health is often maintained by:
- Keeping charge between 20% and 80% when possible
- Avoiding full discharge cycles
- Not leaving devices plugged in at 100% for extended periods
Grapes helps you maintain these practices with customizable alerts!
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
Please check the repository for license information.
Created by Harshul23
Note: This app requires appropriate permissions to monitor battery status. macOS may prompt you to grant necessary permissions on first launch.