A lightweight cross-platform desktop utility that monitors your laptop's battery and alerts you when it reaches a configured charging percentage.
- Download the latest release from the Releases page
- Install .NET 9.0 Desktop Runtime if not already installed
- Run ChargeGuard.exe - it will appear in your notification area
- Connect your charger and let ChargeGuard monitor your battery
- Battery Monitoring: Real-time monitoring of battery percentage and charging status using Windows native power APIs
- Configurable Alerts: Set your preferred charging target (default: 80%) with advance warnings
- Repeated Reminders: Optional reminders if you forget to disconnect the charger
- Escalation Alerts: Stronger alerts when battery exceeds target significantly
- Temporary 100% Mode: Quick option to charge to 100% for this session only
- Configurable Notification Timeout: Adjust how long alerts display before auto-dismissing (3-60 seconds, default 10)
- Battery Analytics: Track charging patterns, discharge rates, and battery health over time
- Interactive Dashboard: WebView2-based web dashboard with interactive charts using Plotly.js
- Daily Statistics: View average charging/discharging times, session counts, and overcharge tracking
- Tray Icon Application: Runs unobtrusively in the notification area
- Privacy-Focused: No network calls, telemetry, or cloud services
- Lightweight: Minimal resource usage with no heavy dependencies
- Language: C# (.NET 9.0)
- Framework: Windows Forms (Windows), AvaloniaUI (Linux - in development)
- Native APIs: Direct Win32 power-event APIs through P/Invoke (Windows), UPower D-Bus (Linux - planned)
- Database: SQLite for battery analytics storage
- Web Dashboard: WebView2 with Plotly.js for interactive charts
- Deployment: Framework-dependent deployment
- Target: Windows 11 (current), Ubuntu Linux (in development)
- Windows 11 (primary platform)
- .NET 9.0 Desktop Runtime (or .NET 9.0 SDK for building from source)
- Ubuntu 20.04+ or Debian 11+ (in development)
- .NET 9.0 Runtime (or .NET 9.0 SDK for building from source)
- UPower D-Bus service (typically pre-installed)
# Restore dependencies
dotnet restore
# Build the solution
dotnet build -c Release
# Run tests
dotnet test -c Release
# Publish for distribution
dotnet publish src/ChargeGuard/ChargeGuard.csproj -c Release -r win-x64 --self-contained falseThe published application will be in src\ChargeGuard\bin\Release\net9.0-windows\win-x64\publish\
# Run all unit tests
dotnet test
# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"- Download the latest installer from the Releases page
- Run the
ChargeGuard-Setup.exeinstaller (requires administrator privileges) - Follow the installation wizard
- The installer will check for .NET 9.0 Desktop Runtime and warn if not installed
- Optionally enable "Start with Windows" during installation
- Download the latest release from the Releases page
- Extract the files to a folder of your choice (e.g.,
C:\Program Files\ChargeGuard) - Create a desktop shortcut if desired
- Run
ChargeGuard.exeto start the application
Linux support is currently in development. To build and run from source:
# Install .NET 9.0 Runtime
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --channel 9.0 --runtime aspnetcore
# Build the Linux version
dotnet build src/ChargeGuard.Linux/ChargeGuard.Linux.csproj -c Release
# Run the application
dotnet run --project src/ChargeGuard.Linux/ChargeGuard.Linux.csprojSee the Build Instructions section below.
Settings are stored in:
%LocalAppData%\ChargeGuard\settings.json
Battery analytics database is stored in:
%LocalAppData%\ChargeGuard\battery_analytics.db
Logs are stored in:
%LocalAppData%\ChargeGuard\Logs\
Log files are automatically rotated with a maximum of 10 files at 5 MB each.
- By default, ChargeGuard starts with Windows and runs minimized in the notification area
- Startup registration is per-user (HKCU registry)
- You can change startup behavior in the settings window
- Note: The installer requires administrator privileges to check for .NET 9.0 Desktop Runtime
ChargeGuard is designed with privacy in mind:
- No Network Access: ChargeGuard does not make any network calls
- No Telemetry: No usage data or analytics are collected
- No Cloud Services: All data stays on your local machine
- Local Storage Only: Settings and logs are stored in your user profile directory
- Open Source: The source code is available for audit
- Monitoring Only: ChargeGuard only monitors battery status. It does not control or stop charging. You must manually disconnect the charger.
- Firmware Variations: Different laptop firmware may report battery events differently. A 60-second fallback timer is used for reliability.
- Windows 11 Primary: Designed and tested for Windows 11. May work on Windows 10 but not officially supported.
- Linux in Development: Linux support is currently in development and may have limited functionality.
- Single Battery: Assumes a single primary battery. Multi-battery systems are not supported.
- WebView2 on Windows: Web dashboard requires WebView2 runtime (typically pre-installed on Windows 11).
- Run ChargeGuard - it will appear in the notification area
- Connect your laptop charger
- ChargeGuard will detect the charging session
- When your battery reaches the target (default: 80%), you'll receive an alert
- Disconnect the charger when alerted
Right-click the tray icon to access:
- Open ChargeGuard: Open the settings window
- Charge to 100% this session: Temporarily set target to 100% for this charging session
- Snooze reminders for 10 minutes: Suppress reminders for 10 minutes
- Pause alerts: Temporarily pause all alerts
- Resume alerts: Resume alert notifications
- Start with Windows: Toggle automatic startup
- View latest log: Open the most recent log file
- About: View application information
- Exit: Close the application
Configure the following in the settings window:
- Normal Target Percentage: Your preferred charging target (1-100%)
- Enable Advance Warning: Show a warning before reaching the target
- Advance Warning Percentage: When to show the advance warning
- Enable Repeated Reminders: Show reminders if charger remains connected
- First Reminder Delay: Time before the first reminder
- Repeated Reminder Interval: Time between subsequent reminders
- Escalation Percentage: When to show a stronger escalation alert
- Enable Sound: Play notification sounds
- Start with Windows: Automatically start with Windows
- Start Minimized: Start minimized to the notification area
- Notification Timeout: How long alerts display before auto-dismissing (3-60 seconds, default 10)
Access the battery analytics dashboard from the tray icon menu:
- Battery Percentage Over Time: Visual chart showing battery level changes
- Charging Pattern: Timeline of charging/discharging periods
- Charging Sessions: Detailed list of all charging sessions
- Battery Readings: Raw battery data with timestamps
- Web Dashboard: Interactive charts with Plotly.js for advanced analysis
The dashboard tracks:
- Average charging and discharging times
- Total charging sessions and overcharge events
- Daily battery statistics
- Battery percentage trends over time
ChargeGuard uses a hybrid architecture with shared core logic and platform-specific implementations:
- ChargeGuard.Core: Shared business logic (battery monitoring interfaces, settings management, alert evaluation)
- ChargeGuard: Windows-specific implementation using Windows Forms and Win32 APIs
- ChargeGuard.Linux: Linux-specific implementation using AvaloniaUI and UPower (in development)
The application is designed to support multiple platforms while maintaining a single source of truth for core functionality:
- Shared Core: Battery monitoring interfaces, settings management, alert evaluation logic
- Platform-Specific UI: Windows Forms for Windows, AvaloniaUI for Linux
- Platform-Specific Services: Win32 APIs for Windows, UPower D-Bus for Linux
For detailed architecture information, see docs/architecture.md.
The settings window has been modernized with:
- Professional blue header with app branding
- Modern flat design with improved color scheme
- Better typography and spacing
- Right-aligned numeric inputs for consistency
- Enhanced button styling with icons
- Improved layout with two-column design
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For issues, questions, or suggestions, please:
- Open an issue on GitHub Issues
- Check existing issues for solutions
- Review the architecture documentation for technical details
- Built with .NET 9.0
- Uses Windows Forms
- Powered by Windows native power management APIs