From ArchWiki
(Redirected from Bar-aint-recursive)
Jump to: navigation, search

lemonbar is a lightweight bar based on XCB. It provides foreground/background color switching along with text alignment and colored under/overlining of text, full utf8 support and reduced memory footprint. Nothing less and nothing more.


Install the lemonbarAUR package, or lemonbar-gitAUR for the development version.


Configuration of lemonbar is now completely done via screenrc-like format strings and command line options as opposed to older versions, where configuration took place at compile-time.

See the man page for a short overview of those configuration options.


lemonbar prints no information on its own. To get any text into lemonbar you need to pipe text into it. The following example would write the text "Hello World" into your bar.


# Echo the text
echo "Hello World"

If you want the text in lemonbar to update through a script, you need to add the -p option. This prevents lemonbar from exiting after stdin is closed.


lemonbar uses the following commands to color the text, background or the under/overline. Colors can be specified via the formats #RRGGBB, #AARRGGBB (with an alpha channel; this requires a compositor to be running), or even #RGB.

The special color - indicates the default color (which is set by command-line flags, or is otherwise the default white text on a black background).

Command Meaning
%{Fcolor} Use color as the foreground/font color
%{Bcolor} Use color as the background
%{Ucolor} Use color for under/overlining the text

Text alignment

lemonbar also supports alignment of text. It uses the following commands to align the text

Command Meaning
%{l} Aligns the text to the left
%{c} Aligns the text to the center
%{r} Aligns the text to the right


The following example prints the date and time in the middle of the bar, the font's color being yellow and the background blue and changes the font/background color back to the default color afterwards. Run it with /path/to/script/example.sh | lemonbar -p


# Define the clock
Clock() {
        DATETIME=$(date "+%a %b %d, %T")

        echo -n "$DATETIME"

# Print the clock

while true; do
        echo "%{c}%{F#FFFF00}%{B#0000FF} $(Clock) %{F-}%{B-}"
        sleep 1

Another example showing the battery percentage. To use this script you need to install acpi.


#Define the battery
Battery() {
        BATPERC=$(acpi --battery | cut -d, -f2)
        echo "$BATPERC"

# Print the percentage
while true; do
        echo "%{r}$(Battery)"
        sleep 1;