
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? 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 Gwern Branwen wrote:
On 2008.06.02 16:26:57 -0500, Lanny Ripple
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))
-- gwern SBU botux Crust SALDV hrt .45 Threat Nike comsat 747