Xmobar
From ArchWiki
Contents |
[edit] Introduction
xmobar is a lightweight bar written in haskell. It is one of the most popular bars to use together with Xmonad.
Even though it is written in haskell, you don't need to know haskell to configure it.
[edit] Instalation
There are currently two versions of xmobar available trough aur. aur:Xmobar and aur:xmobar-darcs, you can also get it directly from the xmobar homepage.
[edit] Configuration
Xmobar can be configured both with command line options and a configuration file (~/.xmobarrc).
Any command line option will override the coresponding option set in the configuration file.
[edit] Using ~/.xmobarrc
Following is a short description of the options you can use in ~/.xmobarrc
- font
- The font to use. If you got XFT fonts enabled, prefix XFT fonts with xft:
- fgColor
- The default colour to use for the font, takes both colour names and hex colours.
- bgColor
- The colour of the bar, takes both colour names and hex colours.
- position
- The position of the bar. Keywords are: Top, TopW, Bottom, BottomW and Static.
- Top/Bottom - The top/bottom of the screen.
- TopW/BottomW - The top/bottom of the screen with a fixed with. They take 2 options:
- Alignment: Left, Center or Right aligned.
- Width: An iteger for the width of the bar in percent.
- Example: Centered at the bottom of the screen, with a width of 75% of the screen.
position = BottomW C 75
- Static - A fixed position on the screen, with a fixed with. Static takes 4 keyword 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: Top left of the screen, with a width of 1024 pixels and height of 15 pixels
- Static - A fixed position on the screen, with a fixed with. Static takes 4 keyword arguments:
position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 }
- commands
- For setting the options of the programs to run (optional).
- commands is a comma seperated list of commands, and their options. Example:
- [Run Memory ["-t","Mem: <usedratio>%"] 10, Run Swap [] 10]
- runs the Memory plugin, with the specified template, and the Swap plugin, with default args. And both with an update every second. (the update rate is in 1/10 seconds)
- sepChar
- The character to be used for indicating commands in the output template (default '%').
- alignSep
- A string of characters for aligning text in the output template. (default '}{') The text before the first char will be left aligned, the text between them will be centered, and the text to the right of the last char will be right aligned.
- template
- The output template is a string containing text and commands.
- %command% - An command to run. The output can contain a flag to set the colour of the text. You can chage the '%' to some other char with sepChar
- <fc=colour></fc> - Sets the colour of a partion of text, takes both colour names and hex colours.
[edit] Example .xmobarrc file
Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
, Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Com "uname" ["-s","-r"] "" 36000
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
]
, sepChar = "%"
, alignSep = "}{"
, template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }{ <fc=#ee9a00>%date%</fc>| %EGPF% | %uname%"
}