[xmonad] xmonad-contrib patch

Gwern Branwen gwern0 at gmail.com
Mon Jun 2 22:53:52 EDT 2008

On 2008.06.02 16:26:57 -0500, Lanny Ripple <lanny at cisco.com> scribbled 21K characters:
> Hi all,
> Just wanted to say Thanks! to everyone for XMonad.  I've got it
> running with gnome for the panels but it blows the gnome WM out of
> the water.
> I did run across some functionality I wanted that didn't exist so I
> wrote it up (attached).  On reflection I should have added a long
> patch message.  I found WindowGo for runOrRaise but often I want to
> pull a window (browser, mail, etc) to my current workspace instead
> of going to the one it's in.  copyOrRun (and underlying copyMaybe)
> do that.
>   Cheers,
>   -ljr

This looks interesting, but I am not thrilled by the duplication of raiseMaybe's code (DRY). Could raiseMaybe and copyMaybe be specialized functions instead, perhaps?

It would look something like this, I guess:

somethingMaybe ∷ (Window -> X ()) -> X () → Query Bool → X ()
somethingMaybe doWin f thatUserQuery = withWindowSet $ λs → do
    maybeResult ← filterM (runQuery thatUserQuery) (W.allWindows s)
    case maybeResult of
      []     → f
      (x:_)  → doWin x

raiseMaybe = somethingMaybe focus
copyMaybe = somethingMaybe (windows . flip copyWindow (currentTag s))

SBU botux Crust SALDV hrt .45 Threat Nike comsat 747
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080602/1960720f/attachment.bin

More information about the xmonad mailing list