Patrick Ziegler edited this page Jul 28, 2018 · 25 revisions

Where to start

To get started, copy the sample configuration:

$ install -Dm644 /usr/share/doc/polybar/config $HOME/.config/polybar/config
$ polybar example

See the Configuration wiki page for more details on how to configure the bar.

Running the app

Usage: polybar [OPTION]... BAR

  -h, --help               Display this help and exit
  -v, --version            Display build details and exit
  -l, --log=LEVEL          Set the logging verbosity (default: WARNING)
                           LEVEL is one of: error, warning, info, trace
  -q, --quiet              Be quiet (will override -l)
  -c, --config=FILE        Path to the configuration file
  -r, --reload             Reload when the configuration has been modified
  -d, --dump=PARAM         Print value of PARAM in bar section and exit
  -m, --list-monitors      Print list of available monitors and exit
  -w, --print-wmname       Print the generated WM_NAME and exit
  -s, --stdout             Output data to stdout instead of drawing it to the X window
  -p, --png=FILE           Save png snapshot to FILE after running for 3 seconds

Launching the bar in your wm's bootstrap routine

Create an executable file containing the startup logic, for example $HOME/.config/polybar/launch.sh:

#!/usr/bin/env bash

# Terminate already running bar instances
killall -q polybar

# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

# Launch bar1 and bar2
polybar bar1 &
polybar bar2 &

echo "Bars launched..."

Make it executable:

$ chmod +x $HOME/.config/polybar/launch.sh

If you are using bspwm, add the following line to bspwmrc:

$HOME/.config/polybar/launch.sh

If you are using i3, add the following lines to your configuration:

exec_always --no-startup-id $HOME/.config/polybar/launch.sh

and remove these

bar {
    i3bar_command $HOME/.config/polybar/launch.sh
}

The first line executes the startup script; the second disables i3's default bar

Override monitor

By defining a reference to an environment variable you could override the monitor at launch:

[bar/mybar]
monitor = ${env:MONITOR:fallback-value}
....
$ MONITOR=override-value polybar mybar

Dealing with XRandR 1.5+ randomized monitor names

If your polybar configuration uses the monitor configuration variable and sometimes fails to start because XRandR 1.5+ is creating randomized monitor names, you can fix this by specifying the MONITOR environment variable as shown above, and setting it in your launch.sh script like this:

MONITOR=$(polybar -m|tail -1|sed -e 's/:.*$//g')

i3: Make the bar appear below windows

To allow other windows to be placed above the bar, or to avoid having the bar visible when in fullscreen mode, you need to use the following two parameters. Note that it will tell the window manager to back off so no area will be reserved, etc.

[bar/mybar]
override-redirect = true
wm-restack = i3
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.