Xmobar configs

Good Day Community,

I am struggling with xmobar, since I am very new to haskell. Any one here familiar with it?
I just want to create a simple xmobar setup?

Thank You

Xmobar on Arch Wiki - basic configuration

Xmonad configurations - - some are using xmobar and provide the configuration.

Xmobar on git - scroll down to configuration example

There are a lot of ways to configure xmobar; best to just do a search and find one you like. The Arch forum has a dedicated “Show us your Xmonad set up” thread with links to xmobar configurations.

Xmobar is/was broken - gets covered by the windows.

I’ll hop in my Way-Back machine later and try to locate my old config.

Are you using it with Xmonad?

Great! Thanks Packrat.

Nah, I am using it with Openbox. Just playing around, but there’s a few things I want before I can switch from polybar. Looking for a bar that is really basic

What are you trying to show? Piping conky to dzen2 is pretty straight forward and doesn’t require haskell. There are also the Arch user contributed bars like lemonbar. Or is the underlying goal here to learn some haskell?

I’ll look into lemonbar as well.

The goal now is to get a basic bar with basic features going. This is what I have thus far.

All I want to add is a workspace indicator, Volume indicator and maybe a wifi/lan clickable network selector icon that executes nmtui when clicked.

I have found this, but am struggling to write code for this in the config

.6.22 Volume Mixer Element Args RefreshRate

  • Aliases to the mixer name and element name separated by a colon. Thus, Volume "default" "Master" [] 10 can be used as %default:Master% .
  • Args: default monitor arguments. Also accepts:
    • -O string On string
      • The string used in place of <status> when the mixer element is on. Defaults to “[on]”.
      • Long option: --on
    • -o string Off string
      • The string used in place of <status> when the mixer element is off. Defaults to “[off]”.
      • Long option: --off
    • -C color On color
      • The color to be used for <status> when the mixer element is on. Defaults to “green”.
      • Long option: --onc
    • -c color Off color
      • The color to be used for <status> when the mixer element is off. Defaults to “red”.
      • Long option: --offc
    • --highd number High threshold for dB. Defaults to -5.0.
    • --lowd number Low threshold for dB. Defaults to -30.0.
    • --volume-icon-pattern string dynamic string for current volume in volumeipat .
  • Variables that can be used with the -t / --template argument: volume , volumebar , volumevbar , volumeipat , dB , status
  • Note that dB might only return 0 on your system. This is known to happen on systems with a pulseaudio backend.
  • Default template: Vol: <volume>% <status>
  • Requires the package alsa-core and alsa-mixer installed in your system. In addition, to activate this plugin you must pass --flags="with_alsa" during compilation.

You will need alsa installed as your sound system/server. ArchLabs is all pulseaudio, I believe.

1 Like

True, I am making progress, I think.

--volume status
, Run Com "pamixer --get-volume-human" ["-s", "-r"] "" 0

This is not giving an error, but I need to make this a template.


    Run Com "uname" ["-s","-r"] "" 0

can be used in the output template as %uname% (and xmobar will call uname only once), while

    Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600

can be used in the output template as %mydate% .

Sometimes, you don’t mind if the command executed exits with an error, or you might want to display a custom message in that case. To that end, you can use the ComX variant:

ComX ProgramName Args ExitMessage Alias RefreshRate

Works like Com , but displaying ExitMessage (a string) if the execution fails. For instance:

    Run ComX "date" ["+\"%a %b %_d %H:%M\""] "N/A" "mydate" 600

will display “N/A” if for some reason the date invocation fails.

I am here atm

--volume status
, Run Com "pamixer" ["--get-volume-human"] "N/A" "volume" 0

I did manage to get the value to be displayed:

--volume status
, Run ComX "pamixer" ["--get-volume-human"] "N/A" "volume" 10 

Problem now is to get Vol: in front of the output

How did you do it for the memory and CPU?

I thought it was added on the output line at the end of the xmobarrc:

"Vol:" %myvolume%

Or something like that.

May be worth it for you to check out pastebin or some other code sharing site for an xmobarrc.

1 Like

The memory and cpu have their own built-in template you can call. The volume is a custom command.

I have succeeded in getting the vol: thing to work.

My next mission is to get xmobarrc to show my desktop number.
Do you know if there is a terminal command for displaying your current workspace name? Or where is this information stored in openbox?

I think it’s wmctrl that will show the desktop number(s). Different commands to show active or all managed desktops.

I think the StdinReader will display that, at least it does for Xmonad:


Here’s my old xmobar configuration: https://raw.githubusercontent.com/Head-on-a-Stick/configs/master/xmobarrc

Not sure how sensible it is to use xmobar with openbox though, are you not bothered by the gigabyte of Haskell dependencies that it pulls in?

1 Like

Thanks, will have a look into your config files.

Yeah, I saw the dependencies. It’s pretty insane.haha. I am looking for a very, very simple taskbar. Have tried tint2, also pypanel.

I think I might try lemonbar next.

How is it Xmonad to configure and use Xmonad?

Even more of a bastard than xmobar :grin:


Lemonbar is lovely though, highly recommended.

1 Like

Depends on how well you know haskell.

There are already a lot of Xmonad extensions written, so it’s just a matter of loading them in the xmonad.hs and recompiling.

Easy enough to start with a basic config and edit it to suit your needs. But haskell is like lua where versions and coding style aren’t always compatible; so can’t really cut-and-paste from another xmonad.hs

It’s actually a really good window manager with some awesome layouts, and easy enough to use once it’s configured. But I don’t know haskell, so it can be tedious to configure, and doesn’t (for me) justify the ~1GB of haskell libraries that get hauled in.

I’m still looking for this config:


xmonad, xmobar, trayer

1 Like

Ah great, thank you for the feedback packrat

Haha I am already struggling with xmobar, so yeah. Don’t think I’ll Haskell any further than I need to haha.

Anyway, I found a great solution for displaying desktops on xmobar

	--Show Desktop with xdotool
	, Run Com "xdotool" ["get_desktop"] "desktop" 1

I am looking for a very, very simple taskbar. Have tried tint2, also pypanel.

Using the Way-back machine for pypanel.

What all do you want to display; workspace, system info, and date only?

Piping conky/script to lemonbar or dzen2 would be about as simple as that gets. Getting the information parsed left/center/right be the only tricky part.

Ah ok, yeah, just workspace, time, date, volume.
This is how my xmobar is looking and I am really liking it