Displays a notification when battery level is above 90% while the computer is charging or below 20% while the commputer is discharging, in order to alert the user to unplug or plug the computer extending the computer's battery life.
Just download the BatteryLimitNotifierSetup.exe
file and run it on your computer. This will automatically perform all the steps discribed in the "Windows manual installation" section.
- Download the
Battery Limit Notifier.exe
andconfig.yaml
files; - Create a folder in the
C:\Program Files
directory namedBatteryLimitNotifier
; - Move the
Battery Limit Notifier.exe
andconfig.yaml
files to the created folder; - Right-click the
Battery Limit Notifier.exe
file and select "Create shortcut"; - Press the
Windows + r
keys to open up a "Run" prompt. In the text field type "shell:common startup" and click "OK". This will open the startup applications folder. - Move the shortcut created in step 5 to the folder opend in step 6.
Once the computer restarts, the program will automatically start. To manually start the program, simply double click the program icon.
Time between notifications, maximum and minimum battery limits can be adjusted, by adjusting the values in the config.yaml
file:
Battery_min_limit: 20 # percent
Battery_max_limit: 90 # percent
Notification_interval: 5 # minutes
This project can be compiled to an executable using a tool such as pyinstaller
or can be run as a script.
(see requirements.txt)
psutil==5.8.0
pypiwin32==223
pywin32==303
PyYAML==6.0
schedule==1.1.0
win10toast==0.9
- Clone repository:
git clone https://github.com/franciscopower/battery-limit-notifier.git
- Create virtual environment:
(assuming Windows PowerShell is being used)
cd battery-limit-notifier python -m venv venv .\venv\Scripts\activate
- Install necessary dependencies:
pip install psutil PyYAML schedule win10toast pyinstaller
- Run pyinstaller:
(substitute
pyinstaller --noconfirm --onefile --windowed --icon "<BASE_DIRECTORY>/battery-limit-notifier/res/Elegantthemes-Beautiful-Flat-One-Color-Battery-full.ico" --name "Battery Limit Notifier" --add-data "<BASE_DIRECTORY>/battery-limit-notifier/res;res/" "<BASE_DIRECTORY>/battery-limit-notifier/battery_limit_notifier.py"
<BASE_DIRECTORY>
for the base directory of the github repository). After running pyinstaller, anoutput
folder will be created with the executable file in it. - Place the created executable file in a folder together with the
config.yaml
file. - Right click on the
Battery Limit Notifier.exe
file and create a shortcut. - Press the
Windows
+r
keys on your keyboard and a windows should appear. Writeshell:common startup
in the text field and clickOK
. This will open up a folder in your windows explorer. - Move the shortcut created in step 5 to the folder opened in step 5.
- Restart your computer and the program should start automatically.
- Install Python and all the dependencies listed above on your computer.
- Download the archive with all the files from this repository onto your computer and unzip it or clone this repository onto your computer.
- Place the
batery_monitor
folder in a folder namedStartup_scripts
in yourC:
drive. The scipts and images should end up intC:\Startup_scripts\battery_monitor
. - Right click on the python file and select Open with > Choose another app. When a pop-up windows appears, select "Python" and check the box "Always use this app to open .py files", before clicking OK.
- Right click on the
battery_limiter_launcher.vbs
file and create a shortcut. - Press the
Windows
+r
keys on your keyboard and a windows should appear. Writeshell:startup
in the text field and clickOK
. This will open up a folder in your windows explorer. - Move the shortcut created in step 4 to the folder opened in step 5.
- Restart your computer and the program should start automatically.