[xmonad] Re: Segmentation fault when accidentally decorating a tabbed layout

Tomáš Janoušek tomi at nomi.cz
Wed Jun 9 19:40:31 EDT 2010


On Wed, Jun 09, 2010 at 07:20:46PM -0400, Weeble wrote:
> Ah, thanks. When does xmonad.hs normally get recompiled? I know I've
> gotten configuration changes to work before without having run xmonad
> --recompile, so I'm a bit confused now.

Well, it's certainly not recompiled if you just upgrade xmonad and not change
xmonad.hs. If you change xmonad.hs, it should be recompiled and you should get
notified of errors, somehow.

> I got it to work by making this change, but I'm not really sure I
> understand what it's doing. Is it right?
> instance Transformer DECORATE Window where
>      transform _ x k = k (simpleDeco shrinkText myTheme x) (const x)
> I added the (const x) on the end there. I looked at the other examples
> in MultiToggle/Instances.hs. I think that it should be a function that
> takes the decorated layout and returns the undecorated version. Some
> of the examples there use (const x) and some of them use a lambda with
> a pattern-match on a layout constructor. I don't know if I could use a
> pattern-match since simpleDeco is a function call. I don't know if I
> need to either - it seems that (const x) works. Is it okay?

You're right that the function should undecorate (or untransform) a layout.
This (const x) is safe only if transforming the layout means replacing it, as
is the case with FULL and NBFULL. If transforming means adding a modifier,
then that last param has to be a function that removes that modifier.
(TODO for myself: add this explanation to the documentation.)

Since simpleDeco takes a layout of type "l a" and returns a layout of type
"ModifiedLayout something l a", you should use that lambda:
    (\(ModifiedLayout _ x') -> x')

Did it really work with (const x)? Using that should more or less make that
particular transformer behave exactly as before the bugfix, IOW cause
segfaults. I think you should get them as soon as you untoggle the DECORATE
transformer. It'd be strange if you didn't :-)

Anyway, just use that lambda and should you get any other strange behaviour,
let me know.

Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

More information about the xmonad mailing list