[xmonad] xmonad-contrib patch

Gwern Branwen gwern0 at gmail.com
Sat Jun 7 04:26:17 EDT 2008


On 2008.06.03 09:42:42 -0500, Lanny Ripple <lanny at cisco.com> scribbled 2.2K characters:
> I wasn't thrilled with it either but wasn't sure where to put
> actionMaybe (the name I had for it).  In WindowGo and import into
> CopyWindow?  In a new Util module and import into both?

For now I would stick it in WindowGo, and import it. One function isn't enough to make a module if there is no compelling reason to. (I mean, if importing WindowGo added some huge dependencies to CopyWindow, sure, but they're both in XMC and depend on the same stuff.)

> There's also the problem that
>
> focus :: win -> X ()
>
> (windows . copyWindow) :: win -> ws -> X()
>
> where 'ws' has to be discovered in actionMaybe.  So
>
>   raiseMaybe = actionMaybe (focus . const)
>   copyMaybe = actionMaybe (windows . copyWindow)
>
>   actionMaybe = (Window -> Workspace -> X ()) -> Query Bool -> X ()
>   actionMaybe doWin f thatUserQuery = withWindowSet $ \x -> do
>       maybeResult <- filterM (runQuery thatUserQuery) (allWindows s)
>       case maybeResult of
>           []      -> f
>           (win:_) -> doWin win (currentTag s)
>
> which I don't know if I'm happy about.
>
> Anyway happy to make the changes if I can get some advice on where
> to put the abstracted (hoisted?, common?) code.
>
>   -ljr

I think it's a good idea to do the abstraction. Right now there are only two users, yes, but I suspect sooner or later, someone will want a 'deleteMaybe', a 'moveMaybe'...

Actually, if we get as many as 4 users, it might make sense to copy it over into XMonad's source whereever the Query monad stuff lives. It would've proven its chops as a utility function, after all.

--
gwern
Ronco psyops BX Pod SUR House SO13 BBE Blowpipe Satellite
-------------- 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/20080607/f9df6501/attachment.bin


More information about the xmonad mailing list