bar-aint-recursive b(ar) a(in't) r(ecursive) 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.
AUR is available in the AUR and can be installed manually or through the use of a AUR helper of your choice.
Configuration of bar is done at compile time in the file config.h. A default config.h looks like this:
/* The height of the bar (in pixels) */ #define BAR_HEIGHT 18 /* The width of the bar. Set to -1 to fit screen */ #define BAR_WIDTH -1 /* Offset from the left. Set to 0 to have no effect */ #define BAR_OFFSET 0 /* Choose between an underline or an overline */ #define BAR_UNDERLINE 1 /* The thickness of the underline (in pixels). Set to 0 to disable. */ #define BAR_UNDERLINE_HEIGHT 2 /* Default bar position, overwritten by '-b' switch */ #define BAR_BOTTOM 0 /* The fonts used for the bar, comma separated. Only the first 2 will be used. */ #define BAR_FONT "-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1","fixed" /* Some fonts don't set the right width for some chars, pheex it */ #define BAR_FONT_FALLBACK_WIDTH 6 /* Color palette */ #define COLOR0 0x1A1A1A /* background */ #define COLOR1 0xA9A9A9 /* foreground */ #define COLOR2 0x303030 #define COLOR3 0xF92672 #define COLOR4 0xA6E22E #define COLOR5 0xFD971F #define COLOR6 0x66D9EF #define COLOR7 0x9E6FFE #define COLOR8 0xAF875F #define COLOR9 0xCCCCC6
To change the config file, clone the git repository and write the config.h. You can run
make in the directory to make a config.h automatically from the
config.def.h text file. After you're done configuring recompile.
Use an overline instead of an underline
bar by default supports underlining text with a certain color, but it also supports overlining text instead. To make
bar overline the text replace the 1 with a 0 in the following line
/* Choose between an underline or an overline */ #define BAR_UNDERLINE 0
Change location of the bar
bar can be placed at the top or the bottom of the screen. It defaults to be on the top. To get
bar on the bottom, edit the following lines in
config.h or use the option -b at runtime.
/* Default bar position, overwritten by '-b' switch */ #define BAR_BOTTOM 1
Change the font
bar does not support image files per se, but it does support bitmap fonts that allows you to use a font with icons such as AUR. To use such a font, install the font and
config.h accordingly. The below example shows how to change the bar font to use
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */ #define BAR_FONT "-misc-stlarch-medium-*-normal-*-10-*-*-*-c-*-*-1","fixed"
bar supports the use of up to ten colors. These are defined at the bottom
config.h. The colors are defined in a hexadecimal format. The last six characters in each of the color lines define the color. For example would the following code change the 6th color(
COLOR6 to black(000000).
#define COLOR6 0x000000
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.
bar uses the following commands to color the text, background or the under/overline.
|\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.|
bar also supports alignment of text. It uses the following commands to align the text
|\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 underlined by COLOR6, the font's color being COLOR1 and the background COLOR0 and changes the underline back to the backgrounds color afterwards.