Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remember xmonad workspace layout?

Tags:

haskell

xmonad

Using XMonad.Layout.PerWorkspace, you can setup independent layouts for each workspace and tweak them for your applications. However, I would like some workspaces to keep track of my settings. E.g. if I hit Mod-h on Workspace 2 using the Tall layout, I want the Tall layout on workspace 2 to have a slightly smaller master-pane the next time I boot (or restart X, for that matter) as well.

This is a frequently required feature, but I cannot find a solution anywhere.

Ideally, this would we stored on some ~/.xmonad/persistentLayouts/workspace*/layout*.conf files which you could erase/edit manually if required. But that would just be a bonus.

I could live with implementing this myself if it doesn't exist, but my file-I/O haskell is a bit rookyish, so maybe somebody can provide some pointers.

like image 223
bitmask Avatar asked Dec 30 '11 16:12

bitmask


1 Answers

xmonad already preserves its state across executable restarts (e.g. mod+q and similar), so why not steal that mechanism? I think it just uses read and show, so you shouldn't need especially strong IO skills; readFile and writeFile should be sufficient. You can steal some code from xmonad itself. The serialization code comes from restart, and the deserialization code comes from xmonad. You'll need to modify it slightly -- you don't want to preserve the window ID information, as that will be invalidated by the new X session -- but much of it can probably be taken wholesale.

like image 168
Daniel Wagner Avatar answered Sep 18 '22 17:09

Daniel Wagner