UnitStatus is a basic widget for Qtile which shows the current status of systemd units.
It may not be particular useful for you and was primarily written as an exercise to familiarise myself with writing Qtile widgets and interacting with d-bus.
The widget is incredibly basic. It subscribes to the systemd d-bus interface, finds the relevant service and displays an icon based on the current status. The widget listens for announced changes to the service and updates the icon accordingly.
Here is a screenshot from my HTPC showing multiple instances of the widget. Green icons are active services and the white is inactive.
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 widget to your config (~/.config/qtile/config.py
):
from unitstatus import UnitStatus
...
screens = [
Screen(
top=bar.Bar(
[
widget.CurrentLayout(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
UnitStatus(label="Avahi",unitname="avahi-daemon.service"),
UnitStatus(), # NetworkManager.service is default
widget.Clock(format='%Y-%m-%d %a %I:%M %p'),
widget.QuickExit(),
],
24,
),
),
]
The widget can be customised with the following arguments:
bus_name | Which bus to use. Accepts 'system' or 'session' |
font | Default font |
fontsize | Font size |
unitname | Name of systemd unit. |
label | Short text to display next to indicator. |
colour_active | Colour for active indicator |
colour_inactive | Colour for active indicator |
colour_failed | Colour for active indicator |
colour_dead | Colour for dead indicator |
indicator_size | Size of indicator (None = up to margin) |
state_map | Map of indicator colours (state: (border, fill)) {"active": ("colour_active", "colour_active"), "inactive": ("colour_inactive", "colour_inactive"), "deactivating": ("colour_inactive", "colour_active"), "activating": ("colour_active", "colour_inactive"), "failed": ("colour_failed", "colour_failed"), "not-found": ("colour_inactive", "colour_failed"), "dead": ("colour_dead", "colour_dead"), } |
If you've used this (great, and thank you) you will find bugs so please file an issue.