[xmonad] darcs patch: Add ShowWName a layout modifier to show the workspace...

David Roundy droundy at darcs.net
Sat Dec 29 13:52:48 EST 2007

On Fri, Dec 28, 2007 at 07:36:06PM +0100, Andrea Rossato wrote:
> this is a follow up of Don's user survey: David Benbennick suggested
> to have the possibility so see the name of the new workspace when you
> switch. David Roundy suggested a way to achieve it. And I, with his
> help, implemented it.
> Still with some problems I seem not to be able to solve. The fist one
> is the old thread related problem: since I need to create a window and
> destroy it after 1 second (the interval can be configured), I need to
> stop the main thread execution for a second. Most of the time xmonad
> is blocked in a foreign call (XNextEvent) in the 'forever' loop. This
> means I cannot destroy the window in a forked thread (which would be
> blocked too): so I have to block the main thread.
> But I have to block the main thread in doLayout (actually redoLayout,
> since we are talking about a layout modifier), which means we block
> *before* returning the windows and rectangles list... which means,
> the window with the workspace name is displayed *before* displaying
> the workspace itself!

We'd definitely want to figure out a way to get a timer event into xmonad.
A stupid way to do this would be by executing

    spawn "sleep 1 && xmessage -timeout 1 ignorethis"

And then looking for this xmessage, removing it from the list to display
(since we don't really want it displayed), and also removing the little
message that we printed nicely.  It's a horrible hack of a way to generate
a timer event, but since we only wait for X events and no other, it seems
that this is something like the way we need to go (unless there's a nicer
way to get X to send us a "timer" event).

Another approach, of course, would be to simply call an external program
that displays the workspace name and then vanishes.  It's a little hokey,
but I suspect kdialog could do it pretty nicely.  Actually, a simple

spawn "kdialog --passivepopup \"" ++ string ++ "\" 1"

ought to do the trick.  It's less easily configurable (except by kde
users), and requires that kdialog be installed, but it's pretty simple.
David Roundy
Department of Physics
Oregon State University

More information about the xmonad mailing list