Introduction
Polybar is a status bar designed for use with tiling window managers like i3, bspwm, and Openbox. It emphasizes ease of configuration through a declarative INI format while remaining fast and resource-efficient, rendering information via a modular system of built-in and custom modules.
What Polybar Does
- Displays workspace indicators, window titles, and system tray
- Shows real-time system info: CPU, RAM, disk, temperature, network, battery
- Renders custom shell script output as first-class modules
- Supports fonts, colors, underlines, and per-module formatting via format strings
- Handles multi-monitor setups with per-output bar instances
Architecture Overview
Polybar is written in C++ and renders directly to an X11 window (or via XCB). Each bar is a single process that ticks modules at configurable intervals. Built-in modules query /proc, sysfs, or D-Bus for system data. Custom/script modules fork shell commands and parse their stdout. IPC commands allow external control via polybar-msg.
Self-Hosting & Configuration
- Install from package manager or compile from source (requires cmake, xcb libs)
- Config file lives at ~/.config/polybar/config.ini (INI format with sections per bar/module)
- Define bars with position, size, fonts, and a list of modules for left/center/right
- Create custom modules using
type = custom/scriptwithexecandintervalkeys - Launch via a shell script called from your WM's startup (e.g., i3 exec_always)
Key Features
- Declarative INI configuration: no programming needed for common setups
- Rich built-in modules: i3/bspwm workspaces, ALSA/PulseAudio volume, MPRIS media
- Custom/script modules for displaying any shell command output
- IPC interface: send commands (hide, show, toggle module) from scripts
- Highly themeable with hex colors, gradients, ramp icons, and format overrides
Comparison with Similar Tools
- i3bar/swaybar — simpler, protocol-driven; less visual customization
- Waybar — Wayland-native alternative with similar module system; required for Sway/Hyprland
- lemonbar — minimal pipe-based bar; more flexible but harder to configure
- tint2 — panel for Openbox; supports taskbar but less module variety
- Eww (ElKowars Widgets) — Lisp-like config for arbitrary desktop widgets; steeper learning curve
FAQ
Q: Does Polybar work on Wayland? A: No. Polybar is X11-only. For Wayland compositors, use Waybar instead.
Q: How do I add a custom script module?
A: Define a module section with type = custom/script, set exec = /path/to/script.sh and interval = 5.
Q: Can I use Nerd Font icons in Polybar? A: Yes. Add a Nerd Font as a secondary font in your bar config and reference glyphs in module labels.
Q: How do I reload the config without restarting? A: Polybar does not hot-reload. Use a launch script that kills existing instances and restarts the process.