This module provides a simple widget showing the status of the laptop battery.
The module uses the UPower DBus interface to obtain information about the current power source.
The widget is drawn by the module rather than using icons from a theme. This allows more customisation of colours.
Here is a screenshot from my HTPC showing the widget in the bar.
You can clone the repository and run:
python setup.py install
or, for Arch users, just copy the PKGBUILD file to your machine and build.
Add the code to your config (~/.config/qtile/config.py
):
from laptopbattery import LaptopBatteryWidget
...
screens = [
Screen(
top=bar.Bar(
[
widget.CurrentLayout(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
LaptopBatteryWidget(),
widget.Clock(format='%Y-%m-%d %a %I:%M %p'),
widget.QuickExit(),
],
24,
),
),
]
The widget allows the battery icon to be resized and to display colours for different states.
The widget can be customised with the following arguments:
font | Default font |
fontsize | Font size |
font_colour | Font colour for information text |
battery_height | Height of battery icon |
battery_width | Size of battery icon |
battery_name | Battery name. None = all batteries |
border_charge_colour | Border colour when charging. |
border_colour | Border colour when discharging. |
border_critical_colour | Border colour when battery low. |
fill_normal | Fill when normal |
fill_low | Fill colour when battery low |
fill_critical | Fill when critically low |
margin | Margin on sides of widget |
spacing | Space between batteries |
percentage_low | Low level threshold. |
percentage_critical | Critical level threshold. |
text_charging | Text to display when charging. |
text_discharging | Text to display when on battery. |
text_displaytime | Time for text to remain before hiding |
If you've used this (great, and thank you) you will find bugs so please file an issue.