[xmonad] Catching exceptions from getWindowAttributes

Daniel Wagner dmwit at dmwit.com
Sun Sep 11 23:11:01 UTC 2016


I suppose the question that this error is asking you is: when
`getWindowAttributes` throws an error, how should `floatLocation` respond?

Perhaps returning some default -- like `(0, RationalRect 0 0 1 1)` or
something -- will be sufficient? I don't know how `floatLocation` gets
used, so I don't know how dangerous a default that would be.

Do we need to change the type of `floatLocation` to admit that it may not
know the right answer?

~d

On Sat, Sep 10, 2016 at 3:09 PM, Adam Sjøgren <asjo at koldfront.dk> wrote:

> 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"
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20160911/62de18eb/attachment.html>


More information about the xmonad mailing list