aboutsummaryrefslogtreecommitdiffstats
path: root/Circle.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
commit4866f2e367dfcf22a9591231ba40948826a1b438 (patch)
tree7a245caee3f146826b267d773b7eaa80386a818e /Circle.hs
parent47589e1913fb9530481caedb543978a30d4323ea (diff)
downloadXMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.gz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.xz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.zip
Hierarchify
darcs-hash:20071101201059-a5988-fc1f1262bec1b69e13ba18ae7cefeafc8c4471d4.gz
Diffstat (limited to 'Circle.hs')
-rw-r--r--Circle.hs70
1 files changed, 0 insertions, 70 deletions
diff --git a/Circle.hs b/Circle.hs
deleted file mode 100644
index d0f343b..0000000
--- a/Circle.hs
+++ /dev/null
@@ -1,70 +0,0 @@
-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}
-
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.Circle
--- Copyright : (c) Peter De Wachter
--- License : BSD-style (see LICENSE)
---
--- Maintainer : Peter De Wachter <pdewacht@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- Circle is an elliptical, overlapping layout, by Peter De Wachter
---
------------------------------------------------------------------------------
-
-module XMonadContrib.Circle (
- -- * Usage
- -- $usage
- Circle (..)
- ) where -- actually it's an ellipse
-
-import Data.List
-import Graphics.X11.Xlib
-import XMonad
-import XMonad.StackSet (integrate, peek)
-
--- $usage
--- You can use this module with the following in your Config.hs file:
---
--- > import XMonadContrib.Circle
--- > layouts = [ Layout Circle ]
-
--- %import XMonadContrib.Circle
-
-data Circle a = Circle deriving ( Read, Show )
-
-instance LayoutClass Circle Window where
- doLayout Circle r s = do layout <- raiseFocus $ circleLayout r $ integrate s
- return (layout, Nothing)
-
-circleLayout :: Rectangle -> [a] -> [(a, Rectangle)]
-circleLayout _ [] = []
-circleLayout r (w:ws) = master : rest
- where master = (w, center r)
- rest = zip ws $ map (satellite r) [0, pi * 2 / fromIntegral (length ws) ..]
-
-raiseFocus :: [(Window, Rectangle)] -> X [(Window, Rectangle)]
-raiseFocus xs = do focused <- withWindowSet (return . peek)
- return $ case find ((== focused) . Just . fst) xs of
- Just x -> x : delete x xs
- Nothing -> xs
-
-center :: Rectangle -> Rectangle
-center (Rectangle sx sy sw sh) = Rectangle x y w h
- where s = sqrt 2 :: Double
- w = round (fromIntegral sw / s)
- h = round (fromIntegral sh / s)
- x = sx + fromIntegral (sw - w) `div` 2
- y = sy + fromIntegral (sh - h) `div` 2
-
-satellite :: Rectangle -> Double -> Rectangle
-satellite (Rectangle sx sy sw sh) a = Rectangle (sx + round (rx + rx * cos a))
- (sy + round (ry + ry * sin a))
- w h
- where rx = fromIntegral (sw - w) / 2
- ry = fromIntegral (sh - h) / 2
- w = sw * 10 `div` 25
- h = sh * 10 `div` 25
-