[xmonad] Issue 522 in xmonad: get default value from XState for XMonad.Util.Invisible

codesite-noreply at google.com codesite-noreply at google.com
Sat Dec 29 21:56:52 CET 2012

Status: New
Owner: vogt.a... at gmail.com
Labels: Type-Enhancement Priority-Low Component-Core Component-Contrib

New issue 522 by vogt.a... at gmail.com: get default value from XState for  

Currently xmonad layouts have to be instances of Show so that the state can  
be saved between restarts. XMonad.Util.Invisible works for state that can  
be replaced without looking at the user's configuration.

To work around this, modules like XMonad.Util.WindowProperties have to be  
written for layouts like XMonad.Layout.IM, when it would have been easier  
on everybody to pass a function (ie ManageHook) to the IM layout.

The attached patch to xmonad core adds Data instances for layouts. The  
module MergeLayout provides a startupHook that replaces the (I Nothing)  
that xmonad gets on restart with what's in the xmonad.hs at the same spot.

Pushing this would break all layouts. Fixing them involves adding Data (and  
Typeable) instances or contexts to existing instances. Normally that  
involves just a `deriving(Data,Typeable)'. I can't convince ghc to generate  
the instances in some cases: I manually wrote instances for Mirror and  
Choose in the dpatch file attached.

Finally there is a possible objection that the Data instance will break  
abstractions: having a (derived) Data instance allows access to the  
constructors. Most of the time I think constructors are not exported to  
make some changes easier, rather than to make sure invalid values cannot be  
constructed (ex. Data.Map).

	require-layouts-to-be-instances-of-data.dpatch  8.7 KB
	MergeLayout.hs  1.5 KB

More information about the xmonad mailing list