
Hy, I tried to switch from dzen2 to xmobar as statusbar for my xmonad but ran into these three problems: 1. I want my Mailcount (how many new mails are there in my Maildir on my harddisk) to be displayed. How can I achieve this? Should I run a external program? Im searching for a solution which needs the less cpu (and io) as possible, as xmonad is running on my notebook. An external shellscript would do a big overhead, so is there a better solution? 2. I wanted to draw a progressbar (oder a rectangle) for the battery-status and the volume. How can this be done? 3. Is there a posilibity to draw icons like dzen2? I just wanted a green envelope for "no new mails" and a red one for "new mails". Is this posible? I know this might not be the right place to ask the question, but perhaps someone can help me. Thanks -- Dominik Bruhn mailto: dominik@dbruhn.de

Hi! On Thu, Dec 13, 2007 at 12:14:03AM +0100, Dominik Bruhn wrote:
Hy, I tried to switch from dzen2 to xmobar as statusbar for my xmonad but ran into these three problems:
1. I want my Mailcount (how many new mails are there in my Maildir on my harddisk) to be displayed. How can I achieve this? Should I run a external program? Im searching for a solution which needs the less cpu (and io) as possible, as xmonad is running on my notebook. An external shellscript would do a big overhead, so is there a better solution?
Well, I think a shell script is ok if you don't need to check your email
account every few seconds...
I use the following quick-and-dirty script for my Maildir: It shows "M 0"
in white if there are no new mails, "M 4" (4 being the total number of new
mails) if there is at least one new mail in the INBOX and the whole thing
in green if there is new mail but nothing in the inbox (just new mails in
subfolders for mailing lists or spam):
#!/bin/sh
nnewmail=`find $MAILDIR/ -wholename "*new/*" |wc -l`
nnewinterestingmail=`ls $MAILDIR/new`
#for xmobar
if [[ $nnewmail == 0 ]]; then
echo "M 0"
elif [[ $nnewinterestingmail != "" ]]; then
echo "

On Thu, 13 Dec 2007 01:19:58 +0100
Hans Philipp Annen
Hi!
On Thu, Dec 13, 2007 at 12:14:03AM +0100, Dominik Bruhn wrote:
Hy, I tried to switch from dzen2 to xmobar as statusbar for my xmonad but ran into these three problems:
1. I want my Mailcount (how many new mails are there in my Maildir on my harddisk) to be displayed. How can I achieve this? Should I run a external program? Im searching for a solution which needs the less cpu (and io) as possible, as xmonad is running on my notebook. An external shellscript would do a big overhead, so is there a better solution?
So, I've written a program that does something similar to this, for dzen2. Basically, it takes the output from xmonad, and adds in the date, battery status, and whatever else you can think of to the actuall input to dzen, thus allowing you to customize the output a bit more. You can write new things to have it output via a simple plugin api (in haskell, of course). If you're interested, I would be happy to cabalize it, and put it up somewhere. --trevor

On Dec 12, 2007 7:34 PM, Trevor Elliott
On Thu, 13 Dec 2007 01:19:58 +0100 Hans Philipp Annen
wrote: Hi!
On Thu, Dec 13, 2007 at 12:14:03AM +0100, Dominik Bruhn wrote:
Hy, I tried to switch from dzen2 to xmobar as statusbar for my xmonad but ran into these three problems:
1. I want my Mailcount (how many new mails are there in my Maildir on my harddisk) to be displayed. How can I achieve this? Should I run a external program? Im searching for a solution which needs the less cpu (and io) as possible, as xmonad is running on my notebook. An external shellscript would do a big overhead, so is there a better solution?
So, I've written a program that does something similar to this, for dzen2. Basically, it takes the output from xmonad, and adds in the date, battery status, and whatever else you can think of to the actuall input to dzen, thus allowing you to customize the output a bit more.
You can write new things to have it output via a simple plugin api (in haskell, of course). If you're interested, I would be happy to cabalize it, and put it up somewhere.
I think this would be a fantastic tool for the xmonad community. (I have a similar program, but it's not at all modular or extensible.) Cabalizing it and putting it up somewhere would be great -- or even better, set up a public darcs repo so people can contribute new plugins. =) -Brent

Hy, I thought about using some unicode-charaters instead of the images, but there is a problem: XMoBar doesnt support Unicode. Even the german umlauts written in UTF-8 appear wrong in the bar. Is this a haskelllimitation and how hard is it to change this? Thanks -- Dominik Bruhn mailto: dominik@dbruhn.de

dominik:
Hy, I thought about using some unicode-charaters instead of the images, but there is a problem: XMoBar doesnt support Unicode. Even the german umlauts written in UTF-8 appear wrong in the bar. Is this a haskelllimitation and how hard is it to change this?
It should be easy to support uft8 (just use the utf8-string IO package). We have utf8-friendly code in XMonadContrib, so I imagine it should be easy to add to xmobar if its missing.

* Don Stewart
It should be easy to support uft8 (just use the utf8-string IO package). We have utf8-friendly code in XMonadContrib, so I imagine it should be easy to add to xmobar if its missing.
Not all the modules is utf8-friendly, e.g. Xmonad.Prompt. All I've found in XMC is 'decode' function in XMonad.Util.XSelection borrowed from utf8-string. Is 'decode' sufficient for Unicode support in other modules? -- Roman I. Cheplyaka http://ro-che.info/

Il Wed, Dec 19, 2007 at 02:06:35PM +0200, Roman Cheplyaka ebbe a scrivere:
* Don Stewart
[2007-12-13 10:49:52-0800] It should be easy to support uft8 (just use the utf8-string IO package). We have utf8-friendly code in XMonadContrib, so I imagine it should be easy to add to xmobar if its missing.
Not all the modules is utf8-friendly, e.g. Xmonad.Prompt. All I've found in XMC is 'decode' function in XMonad.Util.XSelection borrowed from utf8-string. Is 'decode' sufficient for Unicode support in other modules?
The issue is not so simple... First I'm reporting an answer I sent to the original message at the beginning, message that I sent privately for an error of mine... ---- original private msg ------- xmobar doesn't handle multi-byte character yet. it shouldn't be difficult to do it, by the way. I'm really sorry but I've been terribly busy in the last few days, and I think it is not going to be better for another week or so (till the Christmas break (20 of December for me): after that it will be hacking time! And I'll take care of this issue too. If you want to have a try yourself, it is just a matter of using a FontSet instead of a FontStruct, and using XwcDrawImageString instead of XDrawImageString (but I may be missing something right now). If you look in the list archive I've sent some version of xprompt with wide character support in the past. That could be used as an example. ---- end original msg ----------------------------- So, the same is true for every other module in xmonad: since we need to talk to the xserver through xlib, we must call setlocale and use locale aware functions (XwcDrawImageString, etc). Then we can properly deal with the user locale (which can be utf-8). AFAIR we do not need to specifically convert from a given locale, since iconv can do everything for us - but I need to go back to when I was doing that i18n work for xprompt and see if now I'm missing something, which is actually quite probable at the present time. BTW, as Don suggested, the Haskell part should be easy. The Xlib/C part a bit less. As I said originally, in the list archive there are some messages of mine analyzing the issue. Maybe there are still useful, somehow. Today it is my last lecture day. I'll have some more stuff to do tomorrow, but after that I'll be back enjoying some Haskell hacking. Moreover, now that the contrib extension is packaged as a library, doing this i18n stuff should be relatively easier...;) Hope this helps for now. Andrea
participants (7)
-
Andrea Rossato
-
Brent Yorgey
-
Dominik Bruhn
-
Don Stewart
-
Hans Philipp Annen
-
Roman Cheplyaka
-
Trevor Elliott