Lemonbar - ArchWiki

# Lemonbar

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.

## Installation

lemonbar-gitAUR is available in the AUR and can be installed manually or through the use of a AUR helper of your choice.

## Configuration

Configuration of bar 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.

## Usage

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

    #!/bin/bash

    # Echo the text
    echo "Hello World"

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

#### Colors

`bar` uses the following commands to color the text, background or the under/overline. Colors are to be specified via their symbolic names or in #AARRGGBB notation.

Command | Meaning
--- | ---
`%{F#}` | Uses the # color as the font's color
`%{B#}` | Uses the # color as the background
`%{U#}` | Uses the # color for under/overlining the text

#### Text alignment

`bar` 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

#### Examples

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's color back to the default color afterwards. Run it with `/path/to/script/example.sh | bar -p`

    example.sh

    #!/usr/bin/bash

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

            echo -n "$DATE"
    }

    # Print the clock

    while true; do
            echo "%{c}%{Fyellow}%{Bblue} $(Clock)%{F-}"
            sleep 1;
    done

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

    example.sh

    #!/usr/bin/bash

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

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

Category:

- Eye candy