-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Util.Minimize
-- Description :  Common utilities for window minimizing\/maximizing.
-- Copyright   :  (c) Bogdan Sinitsyn (2016)
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  bogdan.sinitsyn@gmail.com
-- Stability   :  unstable
-- Portability :  not portable
--
-- Stores some common utilities for modules used for window minimizing/maximizing
--
-----------------------------------------------------------------------------
module XMonad.Util.Minimize
  ( RectMap
  , Minimized(..)
  ) where

import XMonad
import qualified XMonad.StackSet as W

import qualified Data.Map as M

type RectMap = M.Map Window (Maybe W.RationalRect)

data Minimized = Minimized
    { Minimized -> RectMap
rectMap :: RectMap
    , Minimized -> [Window]
minimizedStack :: [Window]
    }
    deriving (Minimized -> Minimized -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Minimized -> Minimized -> Bool
$c/= :: Minimized -> Minimized -> Bool
== :: Minimized -> Minimized -> Bool
$c== :: Minimized -> Minimized -> Bool
Eq, ReadPrec [Minimized]
ReadPrec Minimized
Int -> ReadS Minimized
ReadS [Minimized]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Minimized]
$creadListPrec :: ReadPrec [Minimized]
readPrec :: ReadPrec Minimized
$creadPrec :: ReadPrec Minimized
readList :: ReadS [Minimized]
$creadList :: ReadS [Minimized]
readsPrec :: Int -> ReadS Minimized
$creadsPrec :: Int -> ReadS Minimized
Read, Int -> Minimized -> ShowS
[Minimized] -> ShowS
Minimized -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Minimized] -> ShowS
$cshowList :: [Minimized] -> ShowS
show :: Minimized -> String
$cshow :: Minimized -> String
showsPrec :: Int -> Minimized -> ShowS
$cshowsPrec :: Int -> Minimized -> ShowS
Show)

instance ExtensionClass Minimized where
  initialValue :: Minimized
initialValue = Minimized { rectMap :: RectMap
rectMap = forall k a. Map k a
M.empty
                           , minimizedStack :: [Window]
minimizedStack = []
                           }
  extensionType :: Minimized -> StateExtension
extensionType = forall a. (Read a, Show a, ExtensionClass a) => a -> StateExtension
PersistentExtension