- C 89.2%
- Python 8.3%
- CMake 2.5%
| include | ||
| protocols | ||
| scripts | ||
| src | ||
| tests | ||
| .gitignore | ||
| CMakeLists.txt | ||
| config.toml | ||
| LICENSE | ||
| README.md | ||
ZBar
A minimalist and performant status bar written in C for Wayland compositors (with layer-shell support), designed to be lightweight and highly configurable.
Features
- Wayland Native: Uses
wlr-layer-shellfor seamless integration - Zurin Integration: UNIX socket-based control for workspaces and window focus for integration with the Zurin compositor
- Modular Widgets:
- Workspaces (interactive)
- Window Title
- Python Integrations (dynamic output, run in the background)
- System Indicators (Volume, Network, Battery, Clock)
- Runtime Configuration: TOML-based configuration for appearance and scripts
- Tooltips: hover hints for the expanded content of each widget
- Configurable Opacity: bar background alpha via
background_opacity
Dependencies
Required
| Package | Description |
|---|---|
| wayland | Wayland core libraries |
| wayland-protocols | Wayland protocol definitions |
| python3 | Required at runtime: plugin scripts run via python3 |
| nerd-fonts | Font support for icons and special characters |
Runtime tools (not linked at build time)
| Tool | Description |
|---|---|
pactl |
Volume widget (PulseAudio or PipeWire's pulse layer) |
busctl |
Used by the bundled music plugin (MPRIS in systemd) |
bluetoothctl |
Used by the bundled Bluetooth plugin (BlueZ) |
zmenu |
Optional: interactive menus for weather/sysmon/bluetooth plugins |
Optional
| Package | Description |
|---|---|
| zurin | Zurin compositor integration |
Build Tools
- CMake 3.12+
- pkg-config
- GCC or Clang
- wayland-scanner
Building
# Create build directory
mkdir build && cd build
# Configure (installs to /usr/bin by default)
cmake ..
# Build
make -j$(nproc)
# Install: binary to /usr/bin, config + plugin scripts to ~/.config/zbar/
# (the directory is created automatically if it does not exist)
sudo make install
If you configured with an older CMake cache (default
/usr/local), reset the prefix withcmake -DCMAKE_INSTALL_PREFIX=/usr ..before installing.
Running
zbar
Reloading the config
zbar re-reads ~/.config/zbar/config.toml on SIGHUP or via the control
socket reload command (appearance and scripts; the bar is rebuilt in
place). If the new file fails to parse, the current configuration stays
active.
kill -HUP "$(pidof zbar)"
Control socket (IPC)
While running, zbar listens on $XDG_RUNTIME_DIR/zbar.sock (mode 0600 +
SO_PEERCRED, one command per line, 5s idle timeout). Follows the same
conventions as zurin's socket:
| Command | Reply |
|---|---|
version |
{"version":"0.2.0","protocol":1,"capabilities":[...]} |
status |
visible, height, config path, script names |
get appearance [key] |
appearance values (colors as #RRGGBB/#AARRGGBB) |
set appearance <key> <value> |
live change: height, gaps_out, border_width, background_opacity, border_color, background_color, font |
scripts |
configured scripts (name -> resolved path) |
widgets |
live widget state: volume{level,muted}, battery{percent,state}, network{status,signal,interface}, clock{time,date} |
reload |
re-read the config file (same path as SIGHUP) |
visibility show|hide|toggle |
hide/show the bar (hidden = buffer detached, no exclusive zone) |
notify <text> |
centered overlay message for ~3s |
subscribe [visibility config] |
streaming mode; events below |
Events: visibility_changed {visible} · config_reloaded.
# quick manual check
printf 'notify Build finished\n' | socat - UNIX-CONNECT:"$XDG_RUNTIME_DIR/zbar.sock"
printf 'set appearance background_opacity 85\n' | socat - UNIX-CONNECT:"$XDG_RUNTIME_DIR/zbar.sock"
Runtime set appearance changes are not persisted: write them to the TOML
(with set appearance they last until zbar exits) or use the zmcp
zbar_config_set tool to patch the file and zbar_reload to apply it.
Configuration
The installer copies config.toml and the plugin scripts to
~/.config/zbar/ (and ~/.config/zbar/scripts/). Edit
~/.config/zbar/config.toml to adjust appearance and scripts.
Add the plugins you want to ~/.config/zbar/scripts.
Example Configuration
[appearance]
height = 32
gaps_out = 8
border_width = 2
border_color = "#1e3a5f"
background_color = "#0a1628"
# 0 = fully transparent, 100 = fully opaque (default)
background_opacity = 100
font = "Mononoki Nerd Font 11"
[scripts]
music = "music.py"
weather = "weather.py"
sysmon = "sysmon.py"
bluetooth = "bluetooth.py"
License
GPLv3. See LICENSE file.
Contributing
Contributions are welcome! This project aims to complement the Zurin compositor ecosystem.