From ca2517b0ea671fb5bb1068d560c40f665626b001 Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Thu, 21 Jun 2007 21:12:07 +0200 Subject: Circle: raise the focus window darcs-hash:20070621191207-06a25-e3d7b4835126c33087d251052a6483e0d9cc5807.gz --- Circle.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Circle.hs b/Circle.hs index fa09e87..f70a831 100644 --- a/Circle.hs +++ b/Circle.hs @@ -20,7 +20,7 @@ module XMonadContrib.Circle ( import Graphics.X11.Xlib import XMonad -import StackSet (integrate) +import StackSet (integrate, Stack(..)) -- $usage -- You can use this module with the following in your Config.hs file: @@ -28,7 +28,7 @@ import StackSet (integrate) -- > import XMonadContrib.Circle circle :: Layout a -circle = Layout { doLayout = \r -> return . circleLayout r . integrate, +circle = Layout { doLayout = \r s -> return . raise (length (up s)) . circleLayout r $ integrate s, modifyLayout = return . const Nothing } circleLayout :: Rectangle -> [a] -> [(a, Rectangle)] @@ -37,6 +37,9 @@ circleLayout r (w:ws) = master : rest where master = (w, center r) rest = zip ws $ map (satellite r) [0, pi * 2 / fromIntegral (length ws) ..] +raise :: Int -> [a] -> [a] +raise n xs = xs !! n : take n xs ++ drop (n + 1) xs + center :: Rectangle -> Rectangle center (Rectangle sx sy sw sh) = Rectangle x y w h where s = sqrt 2 :: Double -- cgit v1.2.3