You are not logged in.

#1 2009-10-25 22:50:25

Mr.Cat
Member
Registered: 2008-09-27
Posts: 79

Xmobar volume plugin

I could not find a ready-to-use plugin for xmobar to display volume level (I don't like Run Com) so, I decided to write one myself. Unfortunately, I didn't manage to make use of haskell alsa binding, so this plugin simply reads 'amixer get' output for selected channel. The plugin makes explicit use of regex-tdfa (the most popular regex backend in aur) since I don't know how to use regular expressions backend-independently.

I'm not sure where should I publish the patch, so I do it here.
Well, maybe, I should fork xmobar and make a pkgbuild for xmobar-mrcat-darcs - but I don't think that one minor patch is worth that.
UPD: Also, there is no easy way to publish a hashed-format darcs repository (xmobar uses hashed repo and patch-tag only supports darcs-2).

The patch for xmobar today's source can be found here: http://gist.github.com/218289
To enable the plugin you should rebuild xmobar from source:
1. Get the xmobar source from darcs: http://code.haskell.org/~arossato/xmobar/#download
2. Download the patch.
3. Cd to the root of xmobar source tree and execute 'darcs apply /path/to/patch'.
4. Build xmobar as described here: http://code.haskell.org/~arossato/xmobar/#installation
5. Make sure to update all the references to xmobar binary in your config files.

Now you may use the volume plugin like this (notice 'AlsaVolume'):

Config { font = "xft:Monospace:pixelsize=11:antialias=true:hinting=true"
       , bgColor = "black"
       , fgColor = "white"
       , position = TopW L 95
       , lowerOnStart = True
       , commands = [ Run Date "%H:%M@%b %d" "date" 600
                    , Run Battery ["-L","50","-H","75","--high","green","--normal","yellow", "--low", "red", "--template", "bat:<left>"] 100
                    , Run AlsaVolume "Master" ["--template", "vol:<vol>"] 10
                    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader% }{ %battery% %alsavol% %date%"
       }

Last edited by Mr.Cat (2009-10-26 20:50:48)

Offline

#2 2009-12-13 21:32:03

Nognir
Member
Registered: 2009-07-25
Posts: 14

Re: Xmobar volume plugin

I'm getting an error:

[nognir@hammer ~]$ xmobar &
[1] 16840
[nognir@hammer ~]$ xmobar: /home/nognir/.xmobarrc: configuration file contains errors at:
"Config" (line 6, column 8):
unexpected ","
expecting space or "}"

[1]+  Exit 1                  xmobar
[nognir@hammer ~]$

I'm using the above .xmobarrc, copied-pasted. Why is that?

Last edited by Nognir (2009-12-13 21:32:38)

Offline

#3 2009-12-15 17:39:10

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: Xmobar volume plugin

Mr.Cat wrote:

I'm not sure where should I publish the patch, so I do it here.
Well, maybe, I should fork xmobar and make a pkgbuild for xmobar-mrcat-darcs - but I don't think that one minor patch is worth that.
UPD: Also, there is no easy way to publish a hashed-format darcs repository (xmobar uses hashed repo and patch-tag only supports darcs-2).

If you still want to maintain this as a separate branch (you don't want it merged in?), and those repository format issues still exist, perhaps you could get an account: http://community.haskell.org/

Offline

#4 2010-01-09 16:32:43

Mr.Cat
Member
Registered: 2008-09-27
Posts: 79

Re: Xmobar volume plugin

Nognir, still having problems?

Vogt, I've got nothing against merging this in, just don't know how to offer the patch to xmobar developers. Also the plugin just polls `amixer get` - probably, not the best way to monitor volume level.

Offline

Board footer

Powered by FluxBB