{-# 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]
(Int -> ReadS StdTransformers)
-> ReadS [StdTransformers]
-> ReadPrec StdTransformers
-> ReadPrec [StdTransformers]
-> Read 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
(Int -> StdTransformers -> ShowS)
-> (StdTransformers -> String)
-> ([StdTransformers] -> ShowS)
-> Show StdTransformers
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
(StdTransformers -> StdTransformers -> Bool)
-> (StdTransformers -> StdTransformers -> Bool)
-> Eq StdTransformers
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 = Full Window -> (Full Window -> l Window) -> b
forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k Full Window
forall a. Full a
Full (l Window -> Full Window -> l Window
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 = ModifiedLayout WithBorder Full Window
-> (ModifiedLayout WithBorder Full Window -> l Window) -> b
forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (Full Window -> ModifiedLayout WithBorder Full Window
forall (l :: * -> *).
LayoutClass l Window =>
l Window -> ModifiedLayout WithBorder l Window
noBorders Full Window
forall a. Full a
Full) (l Window -> ModifiedLayout WithBorder Full Window -> l Window
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 = Mirror l Window -> (Mirror l Window -> l Window) -> b
forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (l Window -> Mirror l Window
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 = ModifiedLayout WithBorder l Window
-> (ModifiedLayout WithBorder l Window -> l Window) -> b
forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (l Window -> ModifiedLayout WithBorder l Window
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 = ModifiedLayout SmartBorder l Window
-> (ModifiedLayout SmartBorder l Window -> l Window) -> b
forall (l' :: * -> *).
LayoutClass l' Window =>
l' Window -> (l' Window -> l Window) -> b
k (l Window -> ModifiedLayout SmartBorder l Window
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')