[xmonad] Catching exceptions from getWindowAttributes

Adam Sjøgren asjo at koldfront.dk
Sat Sep 10 22:09:17 UTC 2016


Daniel writes:

> The simplest thing will be to wrap just the call to `getWindowAttributes`,
> if that's the one you expect to fail.

It is one I observe failing, yes.

> It is not conveniently possible to wrap `X` actions; so instead,
> something like
>
>     withDisplay $ \d -> do
>       ws <- gets windowset
>       ewa <- io $ try (getWindowAttributes d w)
>       case ewa of
>           Left e -> io (putStrLn "HELP! do something!")
>           Right wa -> do
>               let bw = (fromIntegral . wa_border_width) wa
>               {- ... etc. -}

I can't make this construction compile, when I try to change
floatLocation to use it, I get errors about a return value being of type
X () instead of X (ScreenId, W.RationalRect).


  Best regards,

    Adam

-- 
 "Alla för alla, en för en                                    Adam Sjøgren
  Alla för alla, en för en                               asjo at koldfront.dk
  Så börjar vi om igen"



More information about the xmonad mailing list