Assuming you have {{AUR|xmobar-git}} installed (with {{AUR|haskell-libmpd}}), there is a plugin to pull information to display on the status bar about the currently playing song. To add a simple plugin displaying the artist and song of the current track, add this line to your commands list in your {{ic|~/.xmobarrc}}:

+

Assuming you have {{AUR|xmobar-git}} installed (with {{Pkg|haskell-libmpd}}), there is a plugin to pull information to display on the status bar about the currently playing song. To add a simple plugin displaying the artist and song of the current track, add this line to your commands list in your {{ic|~/.xmobarrc}}:

, Run MPD ["-t", "<state>: <artist> - <track>"] 10

, Run MPD ["-t", "<state>: <artist> - <track>"] 10

Finally, you will need to place the plugin some place in your template, as follows:

Finally, you will need to place the plugin some place in your template, as follows:

Revision as of 16:05, 30 September 2017

xmobar is a lightweight, text-based, status bar written in Haskell. It was originally designed to be used together with Xmonad, but it is also usable with any other window manager. While xmobar is written in Haskell, no knowledge of the language is required to install and use it.

This will run xmobar right-aligned, with white background and blue text, using the Weather plugin. Note that the output template must contain at least one command. Read the following section for further explanation of options.

Configuration

The configuration for xmobar is normally defined in ~/.xmobarrc or by specifying a set of command line options when launching xmobar. Any given command line option will override the corresponding option in the configuration file. This can be useful to test new configurations without having to edit a configuration file.

Following is an example ~/.xmobarrc file, followed by a description of each option. Note that each option has a corresponding command line option.

font - The name of the font to use. If XFT fonts are enabled, prefix XFT font names with "xft:".

Example:

font = "xft:Bitstream Vera Sans Mono:size=8:antialias=true"

fgColor - The colour of the font, takes both colour names like black and hex colours like #000000.

bgColor - The colour of the bar, takes both colour names like red and hex colours like #ff0000.

position - The position of the bar. Keywords are: Top/Bottom, TopW/BottomW and Static.

Top/Bottom - The top/bottom of the screen.

TopW/BottomW - The top/bottom of the screen with a fixed width. TopW/BottomW takes 2 arguments:

Alignment: Left, Center or Right aligned.

Width: An integer for the width of the bar in percentage.

Static - A fixed position on the screen, with a fixed width. Static takes 4 arguments:

xpos: Horisontal position in pixels, starting at the upper left corner.

ypos: Vertical position in pixels, starting at the upper left corner.

width: The width of the bar in pixels.

height: The height of the bar in pixels.

Example - centered at the bottom of the screen, with a width of 75% of the screen:

position = BottomW C 75

Example - top left of the screen, with a width of 1024 pixels and height of 15 pixels:

position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 }

border - The position and appearance of a border. Keywords are: TopB, TopBM, BottomB, BottomBM, FullB, FullBM and NoBorder (default)

TopB/BottomB - The top/bottom of the bar

FullB - The entire perimeter of the bar

TopBM/BottomBM/FullBM - Same as other options, except you can specify how many pixels off the bar's edge the border should be drawn. Each option takes a single integer argument.

Example - border placed 3 pixels off bottom edge of the bar:

border: BottomBM 3

sepChar - The character to be used for indicating commands in the output template. Default character is "%".

alignSep - A string of characters for aligning text in the output template. The text before the first character will be left aligned, the text between them will be centered, and the text to the right of the last character will be right aligned. Default string is "}{".

template - The output template is a string containing the text and commands that will be displayed. It contains the alias for a %command%, written text and color tags that sets the colour of text.

commands For setting the options of the programs to run. Commands is a comma seperated list of commands, optionally specified with options.

Example - runs the Memory plugin, with the specified template and the Swap plugin, with default args. Both updates every second:

commands = [Run Memory ["-t","Mem: <usedratio>%"] 10, Run Swap [] 10]

And finally some options which control the bar's general behavior---each is set to a single True or False value:

lowerOnStart - Controls whether to keep the bar behind all other windows.

hideOnStart - Controls whether to hide the bar on start.

allDesktops - Controls whether to show the bar on all desktops.

overrideRedirect - An option necessary for some window managers to prevent the bar from being treated like a normal window.

pickBroadest - On multi-monitor setups place the bar on the widest monitor instead of the first.

persistent - Controls whether to always be visible or not, regardless of the bar's 'hidden' state.

Tips and tricks

There are various plugins that can be used with xmobar - to name a few, there are plugins for disk usage, ram, cpu, battery status, weather report and network activity. A detailed description of each plugin, its dependencies and how to configure it is on the project website.

GMail integration

Assuming you have either xmobar-gmail-darcs or xmobar-gmail installed, you can configure .xmobarrc as follows. Add the GMail plugin to the commands list:

Assuming you have xmobar-gitAUR installed (with haskell-libmpd), there is a plugin to pull information to display on the status bar about the currently playing song. To add a simple plugin displaying the artist and song of the current track, add this line to your commands list in your ~/.xmobarrc:

, Run MPD ["-t", "<state>: <artist> - <track>"] 10

Finally, you will need to place the plugin some place in your template, as follows:

, template = "%StdinReader% }{ ... %mpd% ..."

Conky-Cli integration

It is possible to utilize the features of conky-cliAUR such as disk space, top and system messages, by piping the information from conky into a text file and read the contents from it.
Following is a bash script to use with xmobar for this purpose.