https://github.com/wabri/i3battery
A lightweight and simple battery notifier and warning for linux
https://github.com/wabri/i3battery
battery battery-notifier battery-warning i3 i3battery i3wm linux manage warning
Last synced: about 1 year ago
JSON representation
A lightweight and simple battery notifier and warning for linux
- Host: GitHub
- URL: https://github.com/wabri/i3battery
- Owner: Wabri
- License: gpl-3.0
- Archived: true
- Created: 2019-04-22T13:34:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-23T16:17:27.000Z (over 6 years ago)
- Last Synced: 2025-02-16T07:41:49.346Z (over 1 year ago)
- Topics: battery, battery-notifier, battery-warning, i3, i3battery, i3wm, linux, manage, warning
- Language: Python
- Homepage:
- Size: 491 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# i3battery
[](https://circleci.com/gh/Wabri/i3battery)

I made this script for my configuration of [i3wm](i3wm.org) because in this distro there isn't a battery warning notifier.
This script regularly checks your battery charge and shows a warning in a text notify and if abilitate also an audio warning if you are about to completely drain your battery.
## Install
You need to clone the repository with:
```bash
git clone https://github.com/Wabri/i3battery
```
Then move into i3battery directory:
```bash
cd i3battery
```
And finally run and install i3battery:
```Bash
./install.sh
```
Try to run the help command:
```Bash
i3battery --help
```
If this return the commands list you can use than the i3battery is installed and you can use it.
To test notifications and audio you can use the arguments test:
```bash
i3battery --test-notify --test-audio
```
## Configurations
There are some arguments that you can use to change the configuration:
* **`--audio`** to abilitate audio (default=disable)
* **`--audio_path=`** to specify the audio directory (default=.config/i3battery/audio/)
* **`--no-notify`** to disabilitate notifications (default=abilitate)
* **`--wt=,,`** to set the warning threshold to different values (default=20,15,5)
* **`--time=`** to define the time of cycle (default=20)
* **`--power-path=`** to specify the path of the system class power supply (default=/sys/class/power_supply/)
* **`--bat=`** to specify the battery you want to use (default=BAT0)
Here is an example:
```bash
i3battery --audio --audio-path=/home/wabri/.config/i3battery/audio/ --wt=77,78,76 --time=7 --power-path=/sys/class/power_supply/ --bat=BAT0
```
The default audio warning is installed on `~/.config/i3battery/audio/`, you can change by override the files inside it (Warning: need to be wav files):
* `warning.wav` -> use when reach one of the threshold
* `plug-in.wav` -> use when the adapter goes online
* `plug-out.wav` -> use when the adapter goes offline
## I3 users
To use this on i3wm you need to append to your i3 config file this line:
```i3wm
exec --no-startup-id i3battery
```
The most common use is audio without notifications:
```i3wm
exec --no-startup-id i3battery --audio --no-notify
```
You can configure the running with the configurations below.
## How to make sure the used battery is the right one
Execute this command on terminal:
```Bash
ls /sys/class/power_supply/ | grep "BAT"
```
This can have multiple output:
1. The output is not null and return only the **BAT0** string, you don't need to do anything else and you can use the script as is.
2. You have more than one batteries the output will be something like this:
```Bash
BAT0 BAT1 BAT2
```
In this case you need to specify what battery you want to use for this script by adding this argument:
```Bash
i3battery --bat=BAT2
```
3. You have no output, this is the hard one. Maybe your power supply are stored in other path, than you need to find it and add the argument for that path:
```Bash
i3battery --power-path=/sys/class/power_supply/
```
Make sure to use the right battery even in this case (e.g. BAT1, BAT0)