Segmentation fault when accidentally decorating a tabbed layout

I'm using MultiToggle so that I can press WIN+D to toggle on window decorations when I need to tell similar windows apart. However, I've found that this causes a segmentation fault whenever I use it on a tabbed layout. I assume this is because it's already decorated? I know it may not make much sense to decorate it twice, but I don't think it should segfault when I do this. I've tried to get updated versions from darcs, but I don't really understand how all the dependencies work, so I probably did something wrong. I'm running Ubuntu and I believe I installed GHC using apt-get. I can't remember how I originally installed Cabal, but I did "cabal install X11" and so on to install the dependencies listed in the readme. I synced up xmonad and XMonadContrib from darcs today and rebuilt them and installed them using the "--user" option. The crashes still happen. What should I do next? In terms of experience my Haskell is pretty limited, and my knowledge of package management in Haskell is next to zero. I know my way around a command-line so I hope I'll be able to follow any instructions without too much trouble, but I might need things spelled out for me, particularly if it involves editing (or explaining!) my xmonad.hs file. My xmonad.hs file is attached.

Hello, On Wed, Jun 09, 2010 at 01:53:05PM -0400, Weeble wrote:
I'm using MultiToggle so that I can press WIN+D to toggle on window decorations when I need to tell similar windows apart. However, I've found that this causes a segmentation fault whenever I use it on a tabbed layout. I assume this is because it's already decorated? I know it may not make much sense to decorate it twice, but I don't think it should segfault when I do this. I've tried to get updated versions from darcs, but I don't really understand how all the dependencies work, so I probably did something wrong. [...]
Did you xmonad --recompile? The attached xmonad.hs certainly doesn't compile without errors with latest xmonad and XMC, exactly because a fix for this problem introduced an API change in the Transformer class. The bug that corresponds to what you're seeing is this: http://code.google.com/p/xmonad/issues/detail?id=189 Regards, -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

2010/6/9 Tomáš Janoušek
Did you xmonad --recompile? The attached xmonad.hs certainly doesn't compile without errors with latest xmonad and XMC, exactly because a fix for this problem introduced an API change in the Transformer class.
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. 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?

Hello, 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. Regards, -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

2010/6/9 Tomáš Janoušek
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')
Okay, I used that and it seems to work fine. Thanks!
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 :-)
I toggled the DECORATE transformer on and off several times on the desktop using "gimpLayout" which is a combination of several things including "simpleTabbed". The decoration appeared stacked under the tabs and on top of the window and went away again with no segfaults. Maybe it was okay because the layout didn't otherwise change between the time I toggled the decoration on and off?
Anyway, just use that lambda and should you get any other strange behaviour, let me know.
Thank you!
participants (2)
-
Tomáš Janoušek
-
Weeble