[xmonad] How to organize myLayoutHook?

Jeffrey David Johnson jefdaj at gmail.com
Wed Oct 17 04:38:22 CEST 2012


Most parts of my xmonad.hs have reasonably simple types:

myXPConfig :: XPConfig
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myManageHook :: ManageHook
myLogHook :: Handle -> X ()
myWorkspaces :: [WorkspaceId]
etc.

But myLayoutHook is uniquely complicated. Here's the current version:

myLayoutHook = avoidStruts
              $ smartBorders
              $ onWorkspace "4:gimp" gimp
              $ modWorkspace "1:admin" (workspaceDir "~/dotfiles")
              $ all

     where
         all  = Full ||| tall ||| Grid ||| wide

         tall = named "tall" $ FixedColumn 1 20 80 10
         wide = named "wide" $ Mirror $ tall
         gimp = named "gimp" $ withIM (0.15) (Role "gimp-toolbox")
                             $ reflectHoriz
                             $ withIM (0.25) (Role "gimp-dock")
                             $ all

And here's its type:

myLayoutHook
   :: XMonad.Layout.LayoutModifier.ModifiedLayout
        AvoidStruts
        (XMonad.Layout.LayoutModifier.ModifiedLayout
           SmartBorder
           (PerWorkspace
              (XMonad.Layout.LayoutModifier.ModifiedLayout
                 XMonad.Layout.Renamed.Rename
                 (XMonad.Layout.LayoutModifier.ModifiedLayout
                    AddRoster
                    (XMonad.Layout.LayoutModifier.ModifiedLayout
                       Reflect
                       (XMonad.Layout.LayoutModifier.ModifiedLayout
                          AddRoster
                          (NewSelect
                             Full
                             (NewSelect
(XMonad.Layout.LayoutModifier.ModifiedLayout
                                   XMonad.Layout.Renamed.Rename FixedColumn)
                                (NewSelect
                                   Grid
(XMonad.Layout.LayoutModifier.ModifiedLayout
                                      XMonad.Layout.Renamed.Rename
                                      (Mirror
(XMonad.Layout.LayoutModifier.ModifiedLayout
XMonad.Layout.Renamed.Rename FixedColumn))))))))))
              (PerWorkspace
                 (XMonad.Layout.LayoutModifier.ModifiedLayout
                    WorkspaceDir
                    (NewSelect
                       Full
                       (NewSelect
(XMonad.Layout.LayoutModifier.ModifiedLayout
                             XMonad.Layout.Renamed.Rename FixedColumn)
                          (NewSelect
                             Grid
(XMonad.Layout.LayoutModifier.ModifiedLayout
                                XMonad.Layout.Renamed.Rename
                                (Mirror
(XMonad.Layout.LayoutModifier.ModifiedLayout
                                      XMonad.Layout.Renamed.Rename 
FixedColumn)))))))
                 (NewSelect
                    Full
                    (NewSelect
                       (XMonad.Layout.LayoutModifier.ModifiedLayout
                          XMonad.Layout.Renamed.Rename FixedColumn)
                       (NewSelect
                          Grid
(XMonad.Layout.LayoutModifier.ModifiedLayout
                             XMonad.Layout.Renamed.Rename
                             (Mirror
(XMonad.Layout.LayoutModifier.ModifiedLayout
                                   XMonad.Layout.Renamed.Rename 
FixedColumn)))))))))
        Window

Can that be simplified at all? I find myself wanting to add more 
workspace-specific rules, like workspaceDirs or different layouts, but 
the changes are hard to reason about and always seem to break something.
Thanks
Jeff



More information about the xmonad mailing list