-----------------------------------------------------------------------------
-- |
-- 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
(Minimized -> Minimized -> Bool)
-> (Minimized -> Minimized -> Bool) -> Eq Minimized
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Minimized -> Minimized -> Bool
== :: Minimized -> Minimized -> Bool
$c/= :: Minimized -> Minimized -> Bool
/= :: Minimized -> Minimized -> Bool
Eq, ReadPrec [Minimized]
ReadPrec Minimized
Int -> ReadS Minimized
ReadS [Minimized]
(Int -> ReadS Minimized)
-> ReadS [Minimized]
-> ReadPrec Minimized
-> ReadPrec [Minimized]
-> Read Minimized
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Minimized
readsPrec :: Int -> ReadS Minimized
$creadList :: ReadS [Minimized]
readList :: ReadS [Minimized]
$creadPrec :: ReadPrec Minimized
readPrec :: ReadPrec Minimized
$creadListPrec :: ReadPrec [Minimized]
readListPrec :: ReadPrec [Minimized]
Read, Int -> Minimized -> ShowS
[Minimized] -> ShowS
Minimized -> String
(Int -> Minimized -> ShowS)
-> (Minimized -> String)
-> ([Minimized] -> ShowS)
-> Show Minimized
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Minimized -> ShowS
showsPrec :: Int -> Minimized -> ShowS
$cshow :: Minimized -> String
show :: Minimized -> String
$cshowList :: [Minimized] -> ShowS
showList :: [Minimized] -> ShowS
Show)

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