aboutsummaryrefslogtreecommitdiffstats
path: root/MagicFocus.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 /MagicFocus.hs
parent47589e1913fb9530481caedb543978a30d4323ea (diff)
downloadXMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.gz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.xz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.zip
Hierarchify
darcs-hash:20071101201059-a5988-fc1f1262bec1b69e13ba18ae7cefeafc8c4471d4.gz
Diffstat (limited to 'MagicFocus.hs')
-rw-r--r--MagicFocus.hs51
1 files changed, 0 insertions, 51 deletions
diff --git a/MagicFocus.hs b/MagicFocus.hs
deleted file mode 100644
index 91f38ee..0000000
--- a/MagicFocus.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}
-
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.MagicFocus
--- Copyright : (c) Peter De Wachter <pdewacht@gmail.com>
--- License : BSD
---
--- Maintainer : Peter De Wachter <pdewacht@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- Automagically put the focused window in the master area.
------------------------------------------------------------------------------
-
-module XMonadContrib.MagicFocus
- (-- * Usage
- -- $usage
- MagicFocus(MagicFocus)
- ) where
-
-import Graphics.X11.Xlib
-import XMonad
-import XMonad.StackSet
-
--- $usage
--- > import XMonadContrib.MagicFocus
--- > layouts = [ Layout $ MagicFocus tiled , Layout $ MagicFocus $ Mirror tiled ]
-
--- %import XMonadContrib.MagicFocus
--- %layout , Layout $ MagicFocus tiled
--- %layout , Layout $ MagicFocus $ Mirror tiled
-
-
-data MagicFocus l a = MagicFocus (l a) deriving ( Show , Read )
-
-instance (LayoutClass l Window) => LayoutClass (MagicFocus l) Window where
- doLayout = magicFocus
-
-magicFocus :: LayoutClass l Window => MagicFocus l Window -> Rectangle
- -> Stack Window -> X ([(Window, Rectangle)], Maybe (MagicFocus l Window))
-magicFocus (MagicFocus l) r s =
- withWindowSet $ \wset -> do
- (ws,nl) <- doLayout l r (swap s $ peek wset)
- case nl of
- Nothing -> return (ws, Nothing)
- Just l' -> return (ws, Just $ MagicFocus l')
-
-swap :: (Eq a) => Stack a -> Maybe a -> Stack a
-swap (Stack f u d) focused | Just f == focused = Stack f [] (reverse u ++ d)
- | otherwise = Stack f u d