nixos-config/nixos/system/desktop/home-manager/xmonad/Memo.hs

38 lines
1.2 KiB
Haskell
Raw Normal View History

{-# 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
2020-01-27 23:23:42 +01:00
[ (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
2020-01-27 23:23:42 +01:00
, (W.RationalRect 0.3 0.6 0.4 0.4) -- unten mitte
, (W.RationalRect 0.0 0.6 0.4 0.4) -- unten links
2020-01-27 23:23:42 +01:00
, (W.RationalRect 0.0 0.3 0.4 0.4) -- mitte links
, (W.RationalRect 0.0 0.0 0.4 0.4) -- oben links
2020-01-26 11:55:58 +01:00
, (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)