{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
module XMonad.Layout.DwmStyle
(
dwmStyle
, Theme (..)
, def
, DwmStyle (..)
, shrinkText, CustomShrink(CustomShrink)
, Shrinker(..)
) where
import XMonad
import XMonad.StackSet ( Stack (..) )
import XMonad.Layout.Decoration
dwmStyle :: (Eq a, Shrinker s) => s -> Theme
-> l a -> ModifiedLayout (Decoration DwmStyle s) l a
dwmStyle :: forall a s (l :: * -> *).
(Eq a, Shrinker s) =>
s -> Theme -> l a -> ModifiedLayout (Decoration DwmStyle s) l a
dwmStyle s
s Theme
c = forall (ds :: * -> *) a s (l :: * -> *).
(DecorationStyle ds a, Shrinker s) =>
s -> Theme -> ds a -> l a -> ModifiedLayout (Decoration ds s) l a
decoration s
s Theme
c forall a. DwmStyle a
Dwm
data DwmStyle a = Dwm deriving (Int -> DwmStyle a -> ShowS
forall a. Int -> DwmStyle a -> ShowS
forall a. [DwmStyle a] -> ShowS
forall a. DwmStyle a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DwmStyle a] -> ShowS
$cshowList :: forall a. [DwmStyle a] -> ShowS
show :: DwmStyle a -> String
$cshow :: forall a. DwmStyle a -> String
showsPrec :: Int -> DwmStyle a -> ShowS
$cshowsPrec :: forall a. Int -> DwmStyle a -> ShowS
Show, ReadPrec [DwmStyle a]
ReadPrec (DwmStyle a)
ReadS [DwmStyle a]
forall a. ReadPrec [DwmStyle a]
forall a. ReadPrec (DwmStyle a)
forall a. Int -> ReadS (DwmStyle a)
forall a. ReadS [DwmStyle a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DwmStyle a]
$creadListPrec :: forall a. ReadPrec [DwmStyle a]
readPrec :: ReadPrec (DwmStyle a)
$creadPrec :: forall a. ReadPrec (DwmStyle a)
readList :: ReadS [DwmStyle a]
$creadList :: forall a. ReadS [DwmStyle a]
readsPrec :: Int -> ReadS (DwmStyle a)
$creadsPrec :: forall a. Int -> ReadS (DwmStyle a)
Read)
instance Eq a => DecorationStyle DwmStyle a where
describeDeco :: DwmStyle a -> String
describeDeco DwmStyle a
_ = String
"DwmStyle"
shrink :: DwmStyle a -> Rectangle -> Rectangle -> Rectangle
shrink DwmStyle a
_ Rectangle
_ Rectangle
r = Rectangle
r
pureDecoration :: DwmStyle a
-> Dimension
-> Dimension
-> Rectangle
-> Stack a
-> [(a, Rectangle)]
-> (a, Rectangle)
-> Maybe Rectangle
pureDecoration DwmStyle a
_ Dimension
wh Dimension
ht Rectangle
_ s :: Stack a
s@(Stack a
fw [a]
_ [a]
_) [(a, Rectangle)]
_ (a
w,Rectangle Position
x Position
y Dimension
wid Dimension
_) =
if a
w forall a. Eq a => a -> a -> Bool
== a
fw Bool -> Bool -> Bool
|| Bool -> Bool
not (forall a. Eq a => Stack a -> a -> Bool
isInStack Stack a
s a
w) then forall a. Maybe a
Nothing else forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Position -> Position -> Dimension -> Dimension -> Rectangle
Rectangle (forall a b. (Integral a, Num b) => a -> b
fi Dimension
nx) Position
y Dimension
nwh (forall a b. (Integral a, Num b) => a -> b
fi Dimension
ht)
where nwh :: Dimension
nwh = forall a. Ord a => a -> a -> a
min Dimension
wid forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fi Dimension
wh
nx :: Dimension
nx = forall a b. (Integral a, Num b) => a -> b
fi Position
x forall a. Num a => a -> a -> a
+ Dimension
wid forall a. Num a => a -> a -> a
- Dimension
nwh