37 lines
1.2 KiB
Haskell
37 lines
1.2 KiB
Haskell
{-# LANGUAGE DeriveDataTypeable #-}
|
|
|
|
{-| A hacky module to cycle through a list of
|
|
rectangles, I'm using this to place a floating window somehwere
|
|
when it is in my way -}
|
|
module Memo where
|
|
|
|
import XMonad.Config.Prime
|
|
import qualified XMonad.StackSet as W
|
|
import qualified XMonad.Util.ExtensibleState as ES
|
|
|
|
|
|
|
|
newtype MemoStorage =
|
|
MemoStorage [W.RationalRect]
|
|
deriving (Typeable)
|
|
|
|
-- (RationalRect x y height width)
|
|
instance ExtensionClass MemoStorage where
|
|
initialValue =
|
|
MemoStorage
|
|
(cycle
|
|
[ (W.RationalRect 0.6 0.0 0.4 0.4) -- oben rechts
|
|
, (W.RationalRect 0.6 0.3 0.4 0.4) -- mitte rechts
|
|
, (W.RationalRect 0.6 0.6 0.4 0.4) -- unten rechts
|
|
, (W.RationalRect 0.3 0.6 0.4 0.4) -- unten mitte
|
|
, (W.RationalRect 0.0 0.6 0.4 0.4) -- unten links
|
|
, (W.RationalRect 0.0 0.3 0.4 0.4) -- mitte links
|
|
, (W.RationalRect 0.0 0.0 0.4 0.4) -- oben links
|
|
, (W.RationalRect 0.3 0.0 0.4 0.4) -- oben mitte
|
|
])
|
|
|
|
nextRectangle :: X W.RationalRect
|
|
nextRectangle = do
|
|
MemoStorage next <- ES.get :: X MemoStorage
|
|
ES.modify (\(MemoStorage (_:xs)) -> MemoStorage xs)
|
|
return (head next)
|