New patches: [PerWorkspace: new and improved! Now with emptyLayout and Xinerama support! Brent Yorgey **20080204193119 Note that this patch depends on patches to xmonad core which add an Applicative instance for X and a startupHook. ] { hunk ./XMonad/Layout/PerWorkspace.hs 1 -{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} +{-# OPTIONS_GHC -fglasgow-exts #-} +{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, PatternGuards, DeriveDataTypeable #-} hunk ./XMonad/Layout/PerWorkspace.hs 14 --- Configure layouts on a per-workspace basis. NOTE that this module --- does not (yet) work in conjunction with multiple screens! =( --- --- Note also that when using PerWorkspace, on initial startup workspaces --- may not respond to messages properly until a window has been opened. --- This is due to a limitation inherent in the way PerWorkspace is --- implemented: it cannot decide which layout to use until actually --- required to lay out some windows (which does not happen until a window --- is opened). +-- Configure layouts on a per-workspace basis. hunk ./XMonad/Layout/PerWorkspace.hs 21 - onWorkspace, onWorkspaces + onWorkspace, onWorkspaces, + initPerWorkspace hunk ./XMonad/Layout/PerWorkspace.hs 29 +import Control.Applicative ((<$>), (<*>)) hunk ./XMonad/Layout/PerWorkspace.hs 36 --- and modifying your layoutHook as follows (for example): +-- First, add 'initPerWorkspace' to your startupHook (this is +-- important, PerWorkspace won't work without it!): +-- +-- > startupHook = initPerWorkspace +-- +-- Then modify your layoutHook as follows (for example): hunk ./XMonad/Layout/PerWorkspace.hs 56 --- NOTE that this module does not (yet) work in conjunction with --- multiple screens. =( hunk ./XMonad/Layout/PerWorkspace.hs 76 +data Choice = First | Second + deriving (Read, Show) + hunk ./XMonad/Layout/PerWorkspace.hs 88 - (Maybe Bool) + (Maybe Choice) hunk ./XMonad/Layout/PerWorkspace.hs 93 -instance (LayoutClass l1 a, LayoutClass l2 a) => LayoutClass (PerWorkspace l1 l2) a where +-- | Message informing a layout of the workspace on which it is located. +data YouAreHere = YAH WorkspaceId deriving Typeable +instance Message YouAreHere + +-- | Initialize PerWorkspace layouts by sending YouAreHere messages to +-- the layouts on all workspaces. Suitable for putting in the startupHook. +initPerWorkspace :: X () +initPerWorkspace = runOnWorkspaces $ \w -> do + ml' <- handleMessage (W.layout w) (SomeMessage (YAH (W.tag w))) `catchX` return Nothing + return $ w { W.layout = fromMaybe (W.layout w) ml' } hunk ./XMonad/Layout/PerWorkspace.hs 104 - -- do layout with l1, then return a modified PerWorkspace caching - -- the fact that we're in the matched workspace. - doLayout p@(PerWorkspace _ (Just True) lt _) r s = do - (wrs, mlt') <- doLayout lt r s - return (wrs, Just $ mkNewPerWorkspaceT p mlt') +instance (LayoutClass l1 a, LayoutClass l2 a) => LayoutClass (PerWorkspace l1 l2) a where hunk ./XMonad/Layout/PerWorkspace.hs 106 - -- do layout with l1, then return a modified PerWorkspace caching - -- the fact that we're not in the matched workspace. - doLayout p@(PerWorkspace _ (Just False) _ lf) r s = do - (wrs, mlf') <- doLayout lf r s - return (wrs, Just $ mkNewPerWorkspaceF p mlf') + -- If we know we're supposed to use the first layout, use it. + doLayout p@(PerWorkspace _ (Just First) l1 _) r s = do + (wrs, ml1') <- doLayout l1 r s + return (wrs, Just $ mkNewPerWorkspaceFst p ml1') hunk ./XMonad/Layout/PerWorkspace.hs 111 - -- figure out which layout to use based on the current workspace. - doLayout (PerWorkspace wsIds Nothing l1 l2) r s = do - t <- getCurrentTag - doLayout (PerWorkspace wsIds (Just $ t `elem` wsIds) l1 l2) r s + -- otherwise use the second (either because we know we're supposed + -- to use it, or just as a default if we never got a YouAreHere + -- message). + doLayout p@(PerWorkspace _ _ _ l2) r s = do + (wrs, ml2') <- doLayout l2 r s + return (wrs, Just $ mkNewPerWorkspaceSnd p ml2') hunk ./XMonad/Layout/PerWorkspace.hs 118 - -- handle messages; same drill as doLayout. - handleMessage p@(PerWorkspace _ (Just True) lt _) m = do - mlt' <- handleMessage lt m - return . Just $ mkNewPerWorkspaceT p mlt' + -- emptyLayout is handled in the same way as doLayout. + emptyLayout p@(PerWorkspace _ (Just First) l1 _) r = do + (wrs, ml1') <- emptyLayout l1 r + return (wrs, Just $ mkNewPerWorkspaceFst p ml1') hunk ./XMonad/Layout/PerWorkspace.hs 123 - handleMessage p@(PerWorkspace _ (Just False) _ lf) m = do - mlf' <- handleMessage lf m - return . Just $ mkNewPerWorkspaceF p mlf' + emptyLayout p@(PerWorkspace _ _ _ l2) r = do + (wrs, ml2') <- emptyLayout l2 r + return (wrs, Just $ mkNewPerWorkspaceSnd p ml2') hunk ./XMonad/Layout/PerWorkspace.hs 127 - handleMessage (PerWorkspace _ Nothing _ _) _ = return Nothing + -- Use a YouAreHere message to choose the right layout. + handleMessage (PerWorkspace wsIds _ l1 l2) m + | Just (YAH tag) <- fromMessage m = do + ml1' <- handleMessage l1 m + ml2' <- handleMessage l2 m + let b = if tag `elem` wsIds then First else Second + l1' = fromMaybe l1 ml1' + l2' = fromMaybe l2 ml2' + return . Just $ PerWorkspace wsIds (Just b) l1' l2' hunk ./XMonad/Layout/PerWorkspace.hs 137 - description (PerWorkspace _ (Just True ) l1 _) = description l1 - description (PerWorkspace _ (Just False) _ l2) = description l2 + -- otherwise, just pass all messages on to both underlying layouts. + handleMessage (PerWorkspace wsIds b l1 l2) m = + Just <$> (PerWorkspace wsIds b + <$> (fromMaybe l1 <$> handleMessage l1 m) + <*> (fromMaybe l2 <$> handleMessage l2 m)) hunk ./XMonad/Layout/PerWorkspace.hs 143 - -- description's result is not in the X monad, so we have to wait - -- until a doLayout for the information about which workspace - -- we're in to get cached. + description (PerWorkspace _ (Just First) l1 _) = description l1 + description (PerWorkspace _ (Just Second) _ l2) = description l2 hunk ./XMonad/Layout/PerWorkspace.hs 147 --- | Construct new PerWorkspace values with possibly modified layouts. -mkNewPerWorkspaceT :: PerWorkspace l1 l2 a -> Maybe (l1 a) -> +-- | Construct new PerWorkspace values with a possibly modified first +-- layout. +mkNewPerWorkspaceFst :: PerWorkspace l1 l2 a -> Maybe (l1 a) -> hunk ./XMonad/Layout/PerWorkspace.hs 151 -mkNewPerWorkspaceT (PerWorkspace wsIds b lt lf) mlt' = +mkNewPerWorkspaceFst (PerWorkspace wsIds b lt lf) mlt' = hunk ./XMonad/Layout/PerWorkspace.hs 154 -mkNewPerWorkspaceF :: PerWorkspace l1 l2 a -> Maybe (l2 a) -> +-- | Construct new PerWorkspace values with a possibly modified second +-- layout. +mkNewPerWorkspaceSnd :: PerWorkspace l1 l2 a -> Maybe (l2 a) -> hunk ./XMonad/Layout/PerWorkspace.hs 158 -mkNewPerWorkspaceF (PerWorkspace wsIds b lt lf) mlf' = +mkNewPerWorkspaceSnd (PerWorkspace wsIds b lt lf) mlf' = hunk ./XMonad/Layout/PerWorkspace.hs 161 --- | Get the tag of the currently active workspace. Note that this --- is only guaranteed to be the same workspace for which doLayout --- was called if there is only one screen. -getCurrentTag :: X WorkspaceId -getCurrentTag = gets windowset >>= return . W.tag . W.workspace . W.current } Context: [CycleWS: change example binding for toggleWS from mod-t to mod-z. example bindings shouldn't conflict with default key bindings. Brent Yorgey **20080201202126] [REMOVE RotView: use CycleWS instead. Brent Yorgey **20080201180618 See CycleWS docs for info on switching, or just look at the changes to XMonad.Config.Droundy. ] [CycleWS: add more general functionality that now subsumes the functionality of RotView. Now with parameterized workspace sorting and predicates! Brent Yorgey **20080201121524] [WorkspaceCompare: some refactoring. Brent Yorgey **20080201120430 * Export WorkspaceCompare and WorkspaceSort types. * Extract commonality in sort methods into mkWsSort, which creates a workspace sort from a workspace comparison function. * Rename getSortByTag to getSortByIndex, since it did not actually sort by tag at all; it sorts by index of workspace tags in the user's config. * Create a new getSortByTag function which actually does sort lexicographically by tag. * Enhance documentation. ] [Search.hs: haddock cleanup Brent Yorgey **20080131161948] [Added a handy tip to the documentation of XMonad.Actions.Search v.dijk.bas@gmail.com**20080131122620 The tip explains how to use the submap action to create a handy submap of keybindings for searching. ] [Make LayoutHints a decoration aware layout modifier Andrea Rossato **20080131082314] [Remove LayoutCombinator class and revert PerWorkspace to its Maybe Bool state Andrea Rossato **20080131063929 As I said in order to have a CombinedLayout type instace of LayoutClass and a class for easily writing pure and impure combinators to be feeded to the CombinedLayout together with the layouts to be conbined, there's seems to be the need to change the type of the LayoutClass.description method from l a -> String to l a -> X String. Without that "ugly" change - loosing the purity of the description (please note the *every* methods of that class unless description operates in the X monad) - I'm plainly unable to write something really useful and maintainable. If someone can point me in the right direction I would really really appreciate. Since, in the meantime, PerWorkspace, which has its users, is broken and I broke it, I'm reverting it to it supposedly more beautiful PerWorkspac [WorkspaceId] (Maybe Bool) (l1 a) (l2 a) type. ] [LayoutCombinator class: code clean up Andrea Rossato **20080129224952 - ComboType becomes CombboChooser - removed the stupid doFirst - better comboDescription default implemenation ] [Add a LayoutCombinator class and a CombinedLayout and port PerWorkspace to the new system Andrea Rossato **20080129192903] [Extending.hs: documentation update Brent Yorgey **20080131012728] [SimpleDecoration: export defaultTheme Andrea Rossato **20080130124609] [DynamicLog: lots of additional documentation; add byorgeyPP as an example dzen config Brent Yorgey **20080130205219] [Extended PP with sorting algorithm specification and added xinerama sorting Juraj Hercek **20080109154923 algorithm - idea is to specify sorting algorithm from user's xmonad.hs - xinerama sorting algorithm produces same ordering as pprWindowSetXinerama - default ppSort is set to getSortByTag, so the default functionality is the same as it was before ] [Various decorations related updates Spencer Janssen **20080130064624 * remove deprecated TConf stuff * Remove 'style' from DeConf * Change DeConf to Theme * share defaultTheme across all decorations ] [TwoPane: add description string Joachim Fasting **20080126141332] [Search.hs: add documentation and two more search engines (MathWorld and Google Scholar) Brent Yorgey **20080128190443] [xmonad-contrib.cabal: add build-type field to get rid of Cabal warning Brent Yorgey **20080128190137] [add XMonad.Actions.CycleSelectedLayouts Roman Cheplyaka **20080116205020] [Named: reimplemented as a LayoutModifier and updated Config.Droundy accordingly Andrea Rossato **20080128161343] [LayoutModifier: add modifyDescription for completely override the modified layout description Andrea Rossato **20080128160614] [Make ToggleLayouts and Named implement emptyLayout Andrea Rossato **20080128151535] [Decoration: the fontset must be released even when we don't decorate the first window Andrea Rossato **20080128004411 This is quite an old bug! It affected Tabbed since the very beginning..;) ] [Decoration: I forgot we need to release the fontset too! Andrea Rossato **20080127233521] [Decoration: after deleting the windows we must update the layout modifier Andrea Rossato **20080127231815 Thanks to Feuerbach for reporting this. ] [Reflect: reimplemented as a layout modifier (which makes it compatible with windowArranger and decoration) Andrea Rossato **20080127165854] [SimpleFLoat: change the description to Float (Simple is the decoration description) Andrea Rossato **20080127144556] [ManageDocks: implement AvoidStruts as a layout modifier Andrea Rossato **20080127144301] [ResizeScreen has been rewritten as a layout modifier Andrea Rossato **20080127140837] [LayoutModifier add a modifyLayout Andrea Rossato **20080127140219 Many layouts are written as layout modifiers because they need to change the stack of the rectangle before executing doLayout. This is a major source of bugs. all layout modifiers should be using the LayoutModifier class. This method (modifyLayout) can be used to manipulate the rectangle and the stack before running doLayout by the layout modifier. ] [Make LayoutCombinators deal with emptyLayout Andrea Rossato **20080127092415] [Add ResizeScreen, a layout modifier for modifing the screen geometry Andrea Rossato **20080127010755] [WindowArranger can now arrange all windows Andrea Rossato **20080126233053 This is useful for SimpleFloat, whose state can now persists across layout switches. ] [Arossato: updated my config to recent changes Andrea Rossato **20080126205638] [Add SimpleFloat a very basic floating layout that will place windows according to their size hints Andrea Rossato **20080126205410] [WindoWrranger: export the WindowArranger type (see the upcoming SimpleFloat) Andrea Rossato **20080126204605] [ShowWName: show the name of empty layouts too Andrea Rossato **20080126190214] [ManageDocks: add emptyLayout definition for supporting the new decoration framework Andrea Rossato **20080126185936] [Decoration: code formatting only Andrea Rossato **20080126101354] [export DeConfig to avoid importing Decoration Andrea Rossato **20080126101049] [Prompt: code formatting only Andrea Rossato **20080126093234] [Don't export TConf anymore and export DeConfig instead Andrea Rossato **20080126092141 WARNING: this patch may be breaking your configuration. While it is still possible to use: tabbed shrinkText defaultTConf updating the fields of the defaultTConf record is not possible anymore, since the type TConf is now hidden. WARNING: "tabSize" has been substituted by "decoHeight" You can change your configuration this way: myTConf :: TConf myTConf = defaultTConf { tabSize = 15 , etc.... becomes: myTConf :: DeConfig TabbedDecoration Window myTConf = defaultTabbedConfig { decoHeight = 15 , etc.... and tabbed shrinkText myTConf becomes: tabDeco shrinkText myTConf ] [Tabbed now uses Decoration Andrea Rossato **20080125152311] [Add DwmStyle, a layout modifier to add dwm-style decorations to windows in any layout Andrea Rossato **20080125152152] [Adde SimpleDecoration, a layout modifier to add simple decorations to windows in any layout Andrea Rossato **20080125152106] [Add Layout.Simplest, the simplest layout Andrea Rossato **20080125152015] [Add Decoration, a layout modifier and a class for easily writing decorated layouts Andrea Rossato **20080125151726] [Add WindowArranger, a layout modifier to move and resize windows with the keyboard Andrea Rossato **20080125151633] [ShowWName: moved fi to XUtils Andrea Rossato **20080124134725] [XUtils: add functions for operating on lists of windows and export fi Andrea Rossato **20080124134638] [LayoutModifier: add emptyLayoutMod for dealing with empty workspaces Andrea Rossato **20080124015605] [LayoutModifier: add pureMess and pureModifier to the LayoutModifier class Andrea Rossato **20080122111319] [Layout.ShowWName: generalize the instance Andrea Rossato **20080115045139] [add emptyLayout to MultiToggle Lukas Mai **20080128175313] [grammar fix Lukas Mai **20080128175059] [TAG 0.6 Spencer Janssen **20080127222114] Patch bundle hash: 41ddab73dc70f5ea316116f314a749dd3fa925c3