mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-17 21:33:46 -07:00
Circle: raise the focus window
This commit is contained in:
@@ -20,7 +20,7 @@ module XMonadContrib.Circle (
|
|||||||
|
|
||||||
import Graphics.X11.Xlib
|
import Graphics.X11.Xlib
|
||||||
import XMonad
|
import XMonad
|
||||||
import StackSet (integrate)
|
import StackSet (integrate, Stack(..))
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your Config.hs file:
|
-- You can use this module with the following in your Config.hs file:
|
||||||
@@ -28,7 +28,7 @@ import StackSet (integrate)
|
|||||||
-- > import XMonadContrib.Circle
|
-- > import XMonadContrib.Circle
|
||||||
|
|
||||||
circle :: Layout a
|
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 }
|
modifyLayout = return . const Nothing }
|
||||||
|
|
||||||
circleLayout :: Rectangle -> [a] -> [(a, Rectangle)]
|
circleLayout :: Rectangle -> [a] -> [(a, Rectangle)]
|
||||||
@@ -37,6 +37,9 @@ circleLayout r (w:ws) = master : rest
|
|||||||
where master = (w, center r)
|
where master = (w, center r)
|
||||||
rest = zip ws $ map (satellite r) [0, pi * 2 / fromIntegral (length ws) ..]
|
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 -> Rectangle
|
||||||
center (Rectangle sx sy sw sh) = Rectangle x y w h
|
center (Rectangle sx sy sw sh) = Rectangle x y w h
|
||||||
where s = sqrt 2 :: Double
|
where s = sqrt 2 :: Double
|
||||||
|
Reference in New Issue
Block a user