[xmonad] darcs patch: Generalises modWorkspace to take any layout-transformi...

Brent Yorgey byorgey at seas.upenn.edu
Sat May 4 21:14:55 CEST 2013


Applied, thanks!

On Thu, May 02, 2013 at 01:17:19AM +1000, gopsychonauts at gmail.com wrote:
> 1 patch for repository http://code.haskell.org/XMonadContrib:
> 
> Thu May  2 01:14:25 EST 2013  gopsychonauts at gmail.com
>   * Generalises modWorkspace to take any layout-transforming function
>   
>   modWorkspace already was capable of modifying the layout with an arbitrary
>   layout -> layout function, but its original type restricted it such that it
>   could only apply a single LayoutModifier; this was often inconvenient, as for
>   example it was not possible simply to compose LayoutModifiers for use with
>   modWorkspace.
>   
>   This patch also reimplements onWorkspaces in terms of modWorkspaces, since with
>   the latter's less restrictive type this is now possible.

> 
> [Generalises modWorkspace to take any layout-transforming function
> gopsychonauts at gmail.com**20130501151425
>  Ignore-this: 28c7dc1f6216bb1ebdffef5434ccbcbd
>  
>  modWorkspace already was capable of modifying the layout with an arbitrary
>  layout -> layout function, but its original type restricted it such that it
>  could only apply a single LayoutModifier; this was often inconvenient, as for
>  example it was not possible simply to compose LayoutModifiers for use with
>  modWorkspace.
>  
>  This patch also reimplements onWorkspaces in terms of modWorkspaces, since with
>  the latter's less restrictive type this is now possible.
> ] {
> hunk ./XMonad/Layout/PerWorkspace.hs 47
>  -- Note that @l1@, @l2@, and @l3@ can be arbitrarily complicated
>  -- layouts, e.g. @(Full ||| smartBorders $ tabbed shrinkText
>  -- defaultTConf ||| ...)@, and @m1@ can be any layout modifier, i.e. a
> --- function of type @(l a -> ModifiedLayout lm l a)@.
> +-- function of type @(l a -> ModifiedLayout lm l a)@. (In fact, @m1@ can be any
> +-- function @(LayoutClass l a, LayoutClass l' a) => l a -> l' a at .)
>  --
>  -- In another scenario, suppose you wanted to have layouts A, B, and C
>  -- available on all workspaces, except that on workspace foo you want
> hunk ./XMonad/Layout/PerWorkspace.hs 73
>                  -> (l1 a)         -- ^ layout to use on matched workspaces
>                  -> (l2 a)         -- ^ layout to use everywhere else
>                  -> PerWorkspace l1 l2 a
> -onWorkspaces wsIds l1 l2 = PerWorkspace wsIds False l1 l2
> +onWorkspaces wsIds = modWorkspaces wsIds . const
>  
>  -- | Specify a layout modifier to apply to a particular workspace; layouts
>  --   on all other workspaces will remain unmodified.
> hunk ./XMonad/Layout/PerWorkspace.hs 77
> -modWorkspace :: (LayoutClass l a)
> -             => WorkspaceId                     -- ^ tag of the workspace to match
> -             -> (l a -> ModifiedLayout lm l a)  -- ^ the modifier to apply on the matching workspace
> -             -> l a                             -- ^ the base layout
> -             -> PerWorkspace (ModifiedLayout lm l) l a
> +modWorkspace :: (LayoutClass l1 a, LayoutClass l2 a)
> +             => WorkspaceId    -- ^ tag of the workspace to match
> +             -> (l2 a -> l1 a)  -- ^ the modifier to apply on the matching workspace
> +             -> l2 a           -- ^ the base layout
> +             -> PerWorkspace l1 l2 a
>  modWorkspace wsId = modWorkspaces [wsId]
>  
>  -- | Specify a layout modifier to apply to a particular set of
> hunk ./XMonad/Layout/PerWorkspace.hs 87
>  --   workspaces; layouts on all other workspaces will remain
>  --   unmodified.
> -modWorkspaces :: (LayoutClass l a)
> -              => [WorkspaceId]                   -- ^ tags of the workspaces to match
> -              -> (l a -> ModifiedLayout lm l a)  -- ^ the modifier to apply on the matching workspaces
> -              -> l a                             -- ^ the base layout
> -              -> PerWorkspace (ModifiedLayout lm l) l a
> +modWorkspaces :: (LayoutClass l1 a, LayoutClass l2 a)
> +              => [WorkspaceId] -- ^ tags of the workspaces to match
> +              -> (l2 a -> l1 a) -- ^ the modifier to apply on the matching workspaces
> +              -> l2 a          -- ^ the base layout
> +              -> PerWorkspace l1 l2 a
>  modWorkspaces wsIds f l = PerWorkspace wsIds False (f l) l
>  
>  -- | Structure for representing a workspace-specific layout along with
> }
> 


> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad




More information about the xmonad mailing list