{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Layout.MultiToggle.Instances
-- Description :  Common instances for "XMonad.Layout.MultiToggle".
-- Copyright   :  (c) 2008  Brent Yorgey
-- License     :  BSD-style (see LICENSE)
--
-- Maintainer  :  <byorgey@gmail.com>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Some convenient common instances of the
-- 'XMonad.Layout.MultiToggle.Transformer' class, for use with
-- "XMonad.Layout.MultiToggle".

module XMonad.Layout.MultiToggle.Instances (
  StdTransformers(..)
) where

import XMonad.Layout.MultiToggle

import XMonad
import XMonad.Layout.NoBorders
import XMonad.Layout.LayoutModifier

data StdTransformers = FULL          -- ^ switch to Full layout
                     | NBFULL        -- ^ switch to Full with no borders
                     | MIRROR        -- ^ Mirror the current layout.
                     | NOBORDERS     -- ^ Remove borders.
                     | SMARTBORDERS  -- ^ Apply smart borders.
  deriving (ReadPrec [StdTransformers]
ReadPrec StdTransformers
Int -> ReadS StdTransformers
ReadS [StdTransformers]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StdTransformers]
$creadListPrec :: ReadPrec [StdTransformers]
readPrec :: ReadPrec StdTransformers
$creadPrec :: ReadPrec StdTransformers
readList :: ReadS [StdTransformers]
$creadList :: ReadS [StdTransformers]
readsPrec :: Int -> ReadS StdTransformers
$creadsPrec :: Int -> ReadS StdTransformers
Read, Int -> StdTransformers -> ShowS
[StdTransformers] -> ShowS
StdTransformers -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StdTransformers] -> ShowS
$cshowList :: [StdTransformers] -> ShowS
show :: StdTransformers -> String
$cshow :: StdTransformers -> String
showsPrec :: Int -> StdTransformers -> ShowS
$cshowsPrec :: Int -> StdTransformers -> ShowS
Show, StdTransformers -> StdTransformers -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StdTransformers -> StdTransformers -> Bool
$c/= :: StdTransformers -> StdTransformers -> Bool
== :: StdTransformers -> StdTransformers -> Bool
$c== :: StdTransformers -> StdTransformers -> Bool
Eq)

instance Transformer StdTransformers Window where
    transform :: forall (l :: * -> *) b.
LayoutClass l Window =>
StdTransformers
-> l Window
-> (forall (l' :: * -> *).
    LayoutClass l' Window =>
    l' Window -> (l' Window -> l Window) -> b)
-> b
transform StdTransformers
FULL         l Window
x forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k = forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k forall a. Full a
Full (forall a b. a -> b -> a
const l Window
x)
    transform StdTransformers
NBFULL       l Window
x forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k = forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (forall (l :: * -> *).
LayoutClass l Window =>
l Window -> ModifiedLayout WithBorder l Window
noBorders forall a. Full a
Full) (forall a b. a -> b -> a
const l Window
x)
    transform StdTransformers
MIRROR       l Window
x forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k = forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (forall (l :: * -> *) a. l a -> Mirror l a
Mirror l Window
x) (\(Mirror l Window
x') -> l Window
x')
    transform StdTransformers
NOBORDERS    l Window
x forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k = forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (forall (l :: * -> *).
LayoutClass l Window =>
l Window -> ModifiedLayout WithBorder l Window
noBorders l Window
x) (\(ModifiedLayout WithBorder Window
_ l Window
x') -> l Window
x')
    transform StdTransformers
SMARTBORDERS l Window
x forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k = forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (forall (l :: * -> *) a.
LayoutClass l a =>
l a -> ModifiedLayout SmartBorder l a
smartBorders l Window
x) (\(ModifiedLayout SmartBorder Window
_ l Window
x') -> l Window
x')