A Python project to add a battery status icon to the system tray on your Windows device.
'Battery Lamp' was created out of the need to have an effortless and clear view of my device’s exact battery percentage directly on the taskbar. Windows doesn't provide this information without an extra click and only shows a vague icon. By having 'Battery Lamp' update the battery status in real-time, it ensures that I know precisely when to plug in my charger and avoid the stress of surprise low battery notifications.
Requirements:
- Operating System: Windows 10 or 11.
- Python 3 installed on the system.
It is recommended to install Python with version 3.9 or higher. Python 3.8 and older version have reached their end of life.
Execution Steps:
-
Clone the project or download
battery_percentage.pywfrom the src directory. -
Install the dependencies mentioned in the
requirements.txtfile. -
(Optional but recommended) Set up Battery Lamp to run automatically at startup:
- Use the provided automation script: Run
setup-startup.pyfrom theutilsdirectory. This script will add Battery Lamp to your Windows startup folder, so it launches automatically when you log in. - The script uses the
setup_config.jsonfile to determine the configuration, such as the path to your Python executable and the script location. You can editsetup_config.jsonto customize these settings before running the script. - To run the script, open a terminal in the project directory and execute:
python utils/setup-startup.py
- If you wish to remove Battery Lamp from startup, you can run the script again and follow the prompts.
- Use the provided automation script: Run
-
If you do not wish to use the automation script, you can manually add Battery Lamp to Windows startup:
- Press
Win + R, typeshell:startup, and press Enter. This opens your Startup folder. - Create a shortcut in this folder that points to your Pythonw executable and the
battery_percentage.pywscript. For example:- Target:
C:\Path\To\pythonw.exe C:\Path\To\battery_percentage.pyw
- Target:
- Make sure the shortcut uses
pythonw.exe(notpython.exe) to avoid opening a console window. - Optionally, set an icon for the shortcut using the provided icon in
assets/images/icon/battery_lamp_icon.ico.
- Press
-
To run Battery Lamp immediately (without rebooting), execute the script using a Command Prompt or PowerShell instance with the command:
pythonw src/battery_percentage.pywThis step is useful if you want to test or use Battery Lamp right away, without waiting for your next Windows restart or login. Running this command will immediately launch the tray icon and start showing your battery percentage, so you can confirm everything is working as expected. The program will run in the background, and you can close the terminal window after running the command.
Note
The 'w' in pythonw is crucial as it ensures the script runs without keeping the console busy. In other words, you can continue using the terminal after you ran the above command or close it, the lamp will run in the background.
Result:
If all the above steps are completed correctly, a new icon will appear in the system tray displaying the battery percentage.
Tip
You might need to pin the icon to the taskbar by dragging it out from the hidden icons list in the system tray panel.

Closing the Program:
Right-clicking on the icon will display a context menu with an "Exit" option. Clicking "Exit" will close the program.
Here are different ways the Battery Lamp will glow under different battery status conditions.
| Not Charging | Charging | |
|---|---|---|
| Charge at 100% | ![]() |
![]() |
| Charge at 71% | ![]() |
![]() |
| Charge at 15%^ | ![]() |
![]() |
^ Below critical charge threshold of 20%, later versions should provide an option to change this threshold.
Here are some exciting features being considered for future versions, ordered by complexity of implementation:
- Ability to set custom critical battery threshold.
- Customizable update frequency for battery status checks.
- More themes.
- Themes customiser and preview UI.
- More options in the context menu.
- Quick access settings from the system tray.
- Detailed battery health statistics report exports.
- Graphical dashboard for detailed statistics.
- Actions server.






