[Xmonad] [HUMOR] xmonad useless without programming skills ?

David Roundy droundy at darcs.net
Mon Sep 17 14:17:02 EDT 2007


On Mon, Sep 17, 2007 at 02:09:53PM -0400, Michael F. Lamb wrote:
> I notice that when I restart XMonad with alt+q, it somehow keeps its 
> state. Having not investigated the code very deeply and only seeing what 
> happens to the description in my process list, it looks like the current 
> state is (pardon my vocabulary) serialized into a string which is passed 
> to the new process and interpreted. Is this right?

That's precisely what we do.

> Please correct me if I have this wrong (because I would love to know 
> exactly how it works.) If it's about right, would it also be possible to 
> do the same thing with the "state" of the GUI configurator? To be 
> specific, serializing its state to a text file when changes are made, 
> and loading it when initialized?

Yes, that'd be perfectly feasible.  Any state that can be dynamically
changed via key combinations defined in Config.hs (e.g. the Xinerama
configuration, the Layouts, the gaps, etc) could be configured by a GUI
configurator, with the resultant state preserved across xmonad restarts.

> Does there exist an elegant pattern among Haskell programs for state 
> serialization over multiple invocations?

Writing the state to a file and reading this on startup would be feasible,
except that the actual window handles would no longer be valid.  But yes,
there's no reason why the same approach currently we use for restarts
couldn't also be used for defining the current configuration.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list