Batmon is a dead-simple battery monitor for Linux written in Go. It provides real-time monitoring of battery status and adjusts the power profile accordingly to optimize battery life.
- Real-time monitoring of battery status
- Adjustment of power profile based on battery status
- Support for custom commands and extra commands
- Configuration via a JSON file
- Not written in Rust (the codebase is readable)
- Upower
- powerprofilesctl
- Nix or Go
Batmon is primarily distributed through a Nix flake. You may install it
manually using nix profile install github:NotAShelf/batmon
go install . # this will install Batmon in your $GOPATH
To start using Batmon, use the following command:
batmon
By default, Gomon will load the configuration from config.json in the current
directory. You can specify a different configuration file using the --config
flag:
batmon -c /path/to/config.json
The configuration file should contain a list of batteries to monitor, along with any custom commands or extra commands to execute. Here's an example of a configuration file:
{
"batPaths": [
{
"path": "/sys/class/power_supply/BAT0",
"command": "powerprofilesctl set performance",
"extraCommand": "echo 'Battery is charging' | wall"
}
]
}
-
You can leave
command
empty to use the default behaviour - which will switch active powerprofile usingpowerprofiles set performance | balanced
-
extraCommand
, if provided, will be executed in addition to thecommand
value.