POLYBAR(5)
πΈ NAME πΈ
polybar β the config file for polybar(1) π
(Hi bestie, you're reading the Polybar User Manual, aka polybar(5). This is the page that explains how the config file works, and yes it's gonna be a vibe.)
β¨ DESCRIPTION β¨
Okay so the polybar config file is literally the main character that defines how polybar behaves and how it looks π. It uses a variant of the INI file format β the exact syntax is explained below, but first here's a lil snippet so you can get familiar with the whole situation:
[section_name]
; A comment
# Another comment
background = #ff992a
width = 90%
monitor = HDMI-0
screenchange-reload = false
; Use double quotes if you want to keep the surrounding space.
text = " Some text "
When it starts up, polybar goes looking for the config file in a bunch of places, in this exact order:
- If the
-cor--configcommand line argument is specified, it will use the path given there. π $XDG_CONFIG_HOME/polybar/config$XDG_CONFIG_HOME/polybar/config.ini$HOME/.config/polybar/config$HOME/.config/polybar/config.ini$XDG_CONFIG_DIRS/polybar/config.ini/etc/xdg/polybar/config.ini(only ifXDG_CONFIG_DIRSis not set)/etc/polybar/config.ini
π¦ SYNTAX π¦
The entire config is line-based, meaning everything is constrained to a single line π«Ά. So no multiline values, no other multiline constructs β the only exception is sections. Every single line is one of these four types:
- Empty
- Comment
- Section Header
- Key
Spaces at the beginning and end of each line get ignored, no cap.
NOTE: In this context, "spaces" include the regular space character as well as the tab character and any other character for whichisspace(3)returns true (e.g.\r).
And any line that doesn't fit into one of those four types? That's a syntax error, periodt π.
NOTE: It's recommended that section header names and key names only use alphanumeric characters as well as dashes (-), underscores (_) and forward slashes (/). In practice all characters are allowed except for spaces and any of these:"'=;#[](){}:.$\%
π Section Headers π
Sections are how you group config options together β for example, each module is defined in its own section β¨.
A section is defined by placing the name of the section in square brackets ([ and ]). Like this:
[module/wm]
That declares a section with the name module/wm, and all keys defined after this line will belong to that section until a new section is declared π₯.
WARNING: The first non-empty and non-comment line in the main config file must be a section header β οΈ. It cannot be a key, because that key would not belong to any section. (Imagine a key with no section... embarrassing.)
NOTE: The following section names are reserved and cannot be used inside the config:self,root, andBAR.
π Keys π
Keys are defined by assigning a value to a name, like this:
name = value
This assigns value to the key name in whatever section this line is in π«. Key names need to be unique per section. If the value is enclosed by double-quotes ("), the quotes will be ignored β so the following still assigns value to name:
name = "value"
Spaces around the equal sign are ignored too, so all of these are literally equivalent:
name=value
name = value
name = value
And because spaces at the beginning and end of the line are also ignored, if you want your value to begin and/or end with a space, the value needs to be enclosed in double-quotes:
name = " value "
Here the value of the name key has a leading and trailing whitespace π«Ά.
To treat characters with special meaning as literal characters, you need to prepend them with the backslash (\) escape character:
name = "value\\value\\value"
The value of this key name results in value\value\value.
NOTE: The only character with a special meaning right now is the backslash character (\), which serves as the escape character. More will be added in the future π.
π Empty Lines & Comments π
Empty lines and comment lines are ignored when reading the config file β they do not affect polybar's behavior π. Comment lines start with either the ; or the # character.
NOTE: Inline comments are not supported π. For example, the following line does not end with a comment β the value ofnameis actually set tovalue ; comment:name = value ; comment
π AUTHORS π
Polybar was created by Michael Carlberg and is currently maintained by Patrick Ziegler. Contributors can be listed on GitHub. Respect the icons fr fr π.
β SEE ALSO β
π§ COPYRIGHT π§
2016-2024, Michael Carlberg & contributors
And that's the whole page, bestie β this was polybar version 3.7.2 from the Polybar User Manual, dated Sep 10, 2024. Slay, go write a config that ate π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: polybar 3.7.2-bp160.1.7 Β· MIT
- opensuse-leap 16.0: polybar 3.7.2-bp160.1.7 Β· MIT
- opensuse-leap 16.0: polybar 3.7.2-bp160.1.7 Β· MIT
- opensuse-leap 16.0: polybar 3.7.2-bp160.1.7 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms