packages feed

xmonad-bluetilebranch 0.8.1.3 → 0.9.1.4

raw patch · 19 files changed

+370/−456 lines, 19 filesdep +extensible-exceptionsdep ~X11dep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: extensible-exceptions

Dependency ranges changed: X11, base

API changes (from Hackage documentation)

- XMonad.Core: instance (Monoid a) => Monoid (Query a)
- XMonad.Core: instance (Monoid a) => Monoid (X a)
- XMonad.Core: modifyPosStore :: (PositionStore Window -> PositionStore Window) -> X ()
- XMonad.Core: numlockMask :: XConfig l -> !KeyMask
- XMonad.Core: positionStore :: XState -> !PositionStore Window
- XMonad.Layout: instance (LayoutClass l a) => LayoutClass (Mirror l) a
- XMonad.Layout: instance (Read (l a)) => Read (Mirror l a)
- XMonad.Layout: instance (Show (l a)) => Show (Mirror l a)
- XMonad.Operations: positionStoreInit :: Window -> X ()
- XMonad.PositionStore: posStoreInsert :: (Eq a) => PositionStore a -> a -> Rectangle -> Rectangle -> PositionStore a
- XMonad.PositionStore: posStoreMove :: (Eq a) => PositionStore a -> a -> Position -> Position -> Rectangle -> Rectangle -> PositionStore a
- XMonad.PositionStore: posStoreQuery :: (Eq a) => PositionStore a -> a -> Rectangle -> Maybe Rectangle
- XMonad.PositionStore: posStoreRemove :: (Eq a) => PositionStore a -> a -> PositionStore a
- XMonad.PositionStore: type PositionStore a = [(a, PosStoreRectangle)]
- XMonad.StackSet: focusMaster' :: Stack a -> Stack a
- XMonad.StackSet: instance (Eq a) => Eq (Stack a)
- XMonad.StackSet: instance (Read a) => Read (Stack a)
- XMonad.StackSet: instance (Show a) => Show (Stack a)
+ XMonad: (.|.) :: Bits a => a -> a -> a
+ XMonad: ask :: MonadReader r m => m r
+ XMonad: asks :: MonadReader r m => (r -> a) -> m a
+ XMonad: class Monad m => MonadIO m :: (* -> *)
+ XMonad: class Monad m => MonadReader r m :: (* -> *) | m -> r
+ XMonad: class Monad m => MonadState s m :: (* -> *) | m -> s
+ XMonad: get :: MonadState s m => m s
+ XMonad: gets :: MonadState s m => (s -> a) -> m a
+ XMonad: liftIO :: MonadIO m => IO a -> m a
+ XMonad: local :: MonadReader r m => (r -> r) -> m a -> m a
+ XMonad: modify :: MonadState s m => (s -> s) -> m ()
+ XMonad: put :: MonadState s m => s -> m ()
+ XMonad.Config: defaultConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full))
+ XMonad.Core: PersistentExtension :: a -> StateExtension
+ XMonad.Core: StateExtension :: a -> StateExtension
+ XMonad.Core: class Typeable a => ExtensionClass a
+ XMonad.Core: class Typeable a
+ XMonad.Core: data StateExtension
+ XMonad.Core: extensibleState :: XState -> !Map String (Either String StateExtension)
+ XMonad.Core: extensionType :: ExtensionClass a => a -> StateExtension
+ XMonad.Core: initialValue :: ExtensionClass a => a
+ XMonad.Core: instance Monoid a => Monoid (Query a)
+ XMonad.Core: instance Monoid a => Monoid (X a)
+ XMonad.Core: numberlockMask :: XState -> !KeyMask
+ XMonad.Core: xfork :: MonadIO m => IO () -> m ProcessID
+ XMonad.Layout: instance LayoutClass l a => LayoutClass (Mirror l) a
+ XMonad.Layout: instance Read (l a) => Read (Mirror l a)
+ XMonad.Layout: instance Show (l a) => Show (Mirror l a)
+ XMonad.StackSet: instance Eq a => Eq (Stack a)
+ XMonad.StackSet: instance Read a => Read (Stack a)
+ XMonad.StackSet: instance Show a => Show (Stack a)
- XMonad.Core: XConfig :: !String -> !String -> !String -> !l Window -> !ManageHook -> !Event -> X All -> ![String] -> !KeyMask -> !KeyMask -> !XConfig Layout -> Map (ButtonMask, KeySym) (X ()) -> !XConfig Layout -> Map (ButtonMask, Button) (Window -> X ()) -> !Dimension -> !X () -> !X () -> !Bool -> XConfig l
+ XMonad.Core: XConfig :: !String -> !String -> !String -> !l Window -> !ManageHook -> !Event -> X All -> ![String] -> !KeyMask -> !XConfig Layout -> Map (ButtonMask, KeySym) (X ()) -> !XConfig Layout -> Map (ButtonMask, Button) (Window -> X ()) -> !Dimension -> !X () -> !X () -> !Bool -> XConfig l
- XMonad.Core: XState :: !WindowSet -> !PositionStore Window -> !Set Window -> !Map Window Int -> !Maybe (Position -> Position -> X (), X ()) -> XState
+ XMonad.Core: XState :: !WindowSet -> !Set Window -> !Map Window Int -> !Maybe (Position -> Position -> X (), X ()) -> !KeyMask -> !Map String (Either String StateExtension) -> XState
- XMonad.Core: catchIO :: (MonadIO m) => IO () -> m ()
+ XMonad.Core: catchIO :: MonadIO m => IO () -> m ()
- XMonad.Core: class (Show (layout a)) => LayoutClass layout a
+ XMonad.Core: class Show (layout a) => LayoutClass layout a
- XMonad.Core: class (Typeable a) => Message a
+ XMonad.Core: class Typeable a => Message a
- XMonad.Core: description :: (LayoutClass layout a) => layout a -> String
+ XMonad.Core: description :: LayoutClass layout a => layout a -> String
- XMonad.Core: doLayout :: (LayoutClass layout a) => layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
+ XMonad.Core: doLayout :: LayoutClass layout a => layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
- XMonad.Core: emptyLayout :: (LayoutClass layout a) => layout a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
+ XMonad.Core: emptyLayout :: LayoutClass layout a => layout a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
- XMonad.Core: fromMessage :: (Message m) => SomeMessage -> Maybe m
+ XMonad.Core: fromMessage :: Message m => SomeMessage -> Maybe m
- XMonad.Core: getXMonadDir :: (MonadIO m) => m String
+ XMonad.Core: getXMonadDir :: MonadIO m => m String
- XMonad.Core: handleMessage :: (LayoutClass layout a) => layout a -> SomeMessage -> X (Maybe (layout a))
+ XMonad.Core: handleMessage :: LayoutClass layout a => layout a -> SomeMessage -> X (Maybe (layout a))
- XMonad.Core: installSignalHandlers :: (MonadIO m) => m ()
+ XMonad.Core: installSignalHandlers :: MonadIO m => m ()
- XMonad.Core: io :: (MonadIO m) => IO a -> m a
+ XMonad.Core: io :: MonadIO m => IO a -> m a
- XMonad.Core: pureLayout :: (LayoutClass layout a) => layout a -> Rectangle -> Stack a -> [(a, Rectangle)]
+ XMonad.Core: pureLayout :: LayoutClass layout a => layout a -> Rectangle -> Stack a -> [(a, Rectangle)]
- XMonad.Core: pureMessage :: (LayoutClass layout a) => layout a -> SomeMessage -> Maybe (layout a)
+ XMonad.Core: pureMessage :: LayoutClass layout a => layout a -> SomeMessage -> Maybe (layout a)
- XMonad.Core: recompile :: (MonadIO m) => Bool -> m Bool
+ XMonad.Core: recompile :: MonadIO m => Bool -> m Bool
- XMonad.Core: runLayout :: (LayoutClass layout a) => Workspace WorkspaceId (layout a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
+ XMonad.Core: runLayout :: LayoutClass layout a => Workspace WorkspaceId (layout a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
- XMonad.Core: spawn :: (MonadIO m) => String -> m ()
+ XMonad.Core: spawn :: MonadIO m => String -> m ()
- XMonad.Core: spawnPID :: (MonadIO m) => String -> m ProcessID
+ XMonad.Core: spawnPID :: MonadIO m => String -> m ProcessID
- XMonad.Core: trace :: (MonadIO m) => String -> m ()
+ XMonad.Core: trace :: MonadIO m => String -> m ()
- XMonad.Core: uninstallSignalHandlers :: (MonadIO m) => m ()
+ XMonad.Core: uninstallSignalHandlers :: MonadIO m => m ()
- XMonad.Core: whenJust :: (Monad m) => Maybe a -> (a -> m ()) -> m ()
+ XMonad.Core: whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- XMonad.Layout: splitHorizontallyBy :: (RealFrac r) => r -> Rectangle -> (Rectangle, Rectangle)
+ XMonad.Layout: splitHorizontallyBy :: RealFrac r => r -> Rectangle -> (Rectangle, Rectangle)
- XMonad.Layout: splitVerticallyBy :: (RealFrac r) => r -> Rectangle -> (Rectangle, Rectangle)
+ XMonad.Layout: splitVerticallyBy :: RealFrac r => r -> Rectangle -> (Rectangle, Rectangle)
- XMonad.ManageHook: (<&&>) :: (Monad m) => m Bool -> m Bool -> m Bool
+ XMonad.ManageHook: (<&&>) :: Monad m => m Bool -> m Bool -> m Bool
- XMonad.ManageHook: (<+>) :: ManageHook -> ManageHook -> ManageHook
+ XMonad.ManageHook: (<+>) :: Monoid m => m -> m -> m
- XMonad.ManageHook: (<||>) :: (Monad m) => m Bool -> m Bool -> m Bool
+ XMonad.ManageHook: (<||>) :: Monad m => m Bool -> m Bool -> m Bool
- XMonad.ManageHook: (=?) :: (Eq a) => Query a -> a -> Query Bool
+ XMonad.ManageHook: (=?) :: Eq a => Query a -> a -> Query Bool
- XMonad.Operations: applySizeHints :: (Integral a) => Dimension -> SizeHints -> (a, a) -> D
+ XMonad.Operations: applySizeHints :: Integral a => Dimension -> SizeHints -> (a, a) -> D
- XMonad.Operations: applySizeHintsContents :: (Integral a) => SizeHints -> (a, a) -> D
+ XMonad.Operations: applySizeHintsContents :: Integral a => SizeHints -> (a, a) -> D
- XMonad.Operations: broadcastMessage :: (Message a) => a -> X ()
+ XMonad.Operations: broadcastMessage :: Message a => a -> X ()
- XMonad.Operations: getCleanedScreenInfo :: (MonadIO m) => Display -> m [Rectangle]
+ XMonad.Operations: getCleanedScreenInfo :: MonadIO m => Display -> m [Rectangle]
- XMonad.Operations: sendMessage :: (Message a) => a -> X ()
+ XMonad.Operations: sendMessage :: Message a => a -> X ()
- XMonad.Operations: sendMessageWithNoRefresh :: (Message a) => a -> Workspace WorkspaceId (Layout Window) Window -> X ()
+ XMonad.Operations: sendMessageWithNoRefresh :: Message a => a -> Workspace WorkspaceId (Layout Window) Window -> X ()
- XMonad.StackSet: allWindows :: (Eq a) => StackSet i l a s sd -> [a]
+ XMonad.StackSet: allWindows :: Eq a => StackSet i l a s sd -> [a]
- XMonad.StackSet: ensureTags :: (Eq i) => l -> [i] -> StackSet i l a s sd -> StackSet i l a s sd
+ XMonad.StackSet: ensureTags :: Eq i => l -> [i] -> StackSet i l a s sd -> StackSet i l a s sd
- XMonad.StackSet: findTag :: (Eq a) => a -> StackSet i l a s sd -> Maybe i
+ XMonad.StackSet: findTag :: Eq a => a -> StackSet i l a s sd -> Maybe i
- XMonad.StackSet: float :: (Ord a) => a -> RationalRect -> StackSet i l a s sd -> StackSet i l a s sd
+ XMonad.StackSet: float :: Ord a => a -> RationalRect -> StackSet i l a s sd -> StackSet i l a s sd
- XMonad.StackSet: insertUp :: (Eq a) => a -> StackSet i l a s sd -> StackSet i l a s sd
+ XMonad.StackSet: insertUp :: Eq a => a -> StackSet i l a s sd -> StackSet i l a s sd
- XMonad.StackSet: lookupWorkspace :: (Eq s) => s -> StackSet i l a s sd -> Maybe i
+ XMonad.StackSet: lookupWorkspace :: Eq s => s -> StackSet i l a s sd -> Maybe i
- XMonad.StackSet: member :: (Eq a) => a -> StackSet i l a s sd -> Bool
+ XMonad.StackSet: member :: Eq a => a -> StackSet i l a s sd -> Bool
- XMonad.StackSet: new :: (Integral s) => l -> [i] -> [sd] -> StackSet i l a s sd
+ XMonad.StackSet: new :: Integral s => l -> [i] -> [sd] -> StackSet i l a s sd
- XMonad.StackSet: renameTag :: (Eq i) => i -> i -> StackSet i l a s sd -> StackSet i l a s sd
+ XMonad.StackSet: renameTag :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd
- XMonad.StackSet: sink :: (Ord a) => a -> StackSet i l a s sd -> StackSet i l a s sd
+ XMonad.StackSet: sink :: Ord a => a -> StackSet i l a s sd -> StackSet i l a s sd
- XMonad.StackSet: tagMember :: (Eq i) => i -> StackSet i l a s sd -> Bool
+ XMonad.StackSet: tagMember :: Eq i => i -> StackSet i l a s sd -> Bool

Files

Main.hs view
@@ -17,7 +17,6 @@ import XMonad  import Control.Monad (unless)-import System.IO import System.Info import System.Environment import System.Posix.Process (executeFile)@@ -26,6 +25,8 @@ import Paths_xmonad_bluetilebranch (version) import Data.Version (showVersion) +import Graphics.X11.Xinerama (compiledWithXinerama)+ #ifdef TESTING import qualified Properties #endif@@ -39,15 +40,21 @@     let launch = catchIO buildLaunch >> xmonad defaultConfig     case args of         []                    -> launch-        ["--resume", _]       -> launch+        ("--resume":_)        -> launch         ["--help"]            -> usage         ["--recompile"]       -> recompile True >>= flip unless exitFailure         ["--restart"]         -> sendRestart >> return ()-        ["--version"]         -> putStrLn ("xmonad " ++ showVersion version)+        ["--version"]         -> putStrLn $ unwords shortVersion+        ["--verbose-version"] -> putStrLn . unwords $ shortVersion ++ longVersion #ifdef TESTING         ("--run-tests":_)     -> Properties.main #endif         _                     -> fail "unrecognized flags"+ where+    shortVersion = ["xmonad", showVersion version]+    longVersion  = [ "compiled by", compilerName, showVersion compilerVersion+                   , "for",  arch ++ "-" ++ os+                   , "\nXinerama:", show compiledWithXinerama ]  usage :: IO () usage = do@@ -58,6 +65,7 @@         "  --help                       Print this message" :         "  --version                    Print the version number" :         "  --recompile                  Recompile your ~/.xmonad/xmonad.hs" :+        "  --replace                    Replace the running window manager with xmonad" :         "  --restart                    Request a running xmonad process to restart" : #ifdef TESTING         "  --run-tests                  Run the test suite" :@@ -70,7 +78,7 @@ -- --   * ghc missing -----   * "~\/.xmonad\/xmonad.hs" missing+--   * both "~\/.xmonad\/xmonad.hs" and "~\/.xmonad\/xmonad-$arch-$os" missing -- --   * xmonad.hs fails to compile --
XMonad/Config.hs view
@@ -25,11 +25,11 @@ -- Useful imports -- import XMonad.Core as XMonad hiding-    (workspaces,manageHook,numlockMask,keys,logHook,startupHook,borderWidth,mouseBindings+    (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings     ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse     ,handleEventHook) import qualified XMonad.Core as XMonad-    (workspaces,manageHook,numlockMask,keys,logHook,startupHook,borderWidth,mouseBindings+    (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings     ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse     ,handleEventHook) @@ -64,22 +64,6 @@ defaultModMask :: KeyMask defaultModMask = mod1Mask --- | The mask for the numlock key. Numlock status is "masked" from the--- current modifier status, so the keybindings will work with numlock on or--- off. You may need to change this on some systems.------ You can find the numlock modifier by running "xmodmap" and looking for a--- modifier with Num_Lock bound to it:------ > $ xmodmap | grep Num--- > mod2        Num_Lock (0x4d)------ Set numlockMask = 0 if you don't have a numlock key, or want to treat--- numlock status separately.----numlockMask :: KeyMask-numlockMask = mod2Mask- -- | Width of the window border in pixels. -- borderWidth :: Dimension@@ -236,15 +220,15 @@ -- | Mouse bindings: default actions bound to mouse events -- mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())-mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $+mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList     -- mod-button1 %! Set the window to floating mode and move by dragging-    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w-                                          >> windows W.shiftMaster))+    [ ((modMask, button1), \w -> focus w >> mouseMoveWindow w+                                          >> windows W.shiftMaster)     -- mod-button2 %! Raise the window to the top of the stack-    , ((modMask, button2), (\w -> focus w >> windows W.shiftMaster))+    , ((modMask, button2), \w -> focus w >> windows W.shiftMaster)     -- mod-button3 %! Set the window to floating mode and resize by dragging-    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w-                                          >> windows W.shiftMaster))+    , ((modMask, button3), \w -> focus w >> mouseResizeWindow w+                                         >> windows W.shiftMaster)     -- you may also bind events to the mouse scroll wheel (button4 and button5)     ] @@ -256,7 +240,6 @@     , XMonad.terminal           = terminal     , XMonad.normalBorderColor  = normalBorderColor     , XMonad.focusedBorderColor = focusedBorderColor-    , XMonad.numlockMask        = numlockMask     , XMonad.modMask            = defaultModMask     , XMonad.keys               = keys     , XMonad.logHook            = logHook@@ -264,4 +247,5 @@     , XMonad.mouseBindings      = mouseBindings     , XMonad.manageHook         = manageHook     , XMonad.handleEventHook    = handleEventHook-    , XMonad.focusFollowsMouse  = focusFollowsMouse }+    , XMonad.focusFollowsMouse  = focusFollowsMouse+    }
XMonad/Core.hs view
@@ -24,17 +24,17 @@     XConf(..), XConfig(..), LayoutClass(..),     Layout(..), readsLayout, Typeable, Message,     SomeMessage(..), fromMessage, LayoutMessages(..),+    StateExtension(..), ExtensionClass(..),     runX, catchX, userCode, userCodeDef, io, catchIO, installSignalHandlers, uninstallSignalHandlers,-    withDisplay, withWindowSet, modifyPosStore, isRoot, runOnWorkspaces,-    getAtom, spawn, spawnPID, getXMonadDir, recompile, trace, whenJust, whenX,+    withDisplay, withWindowSet, isRoot, runOnWorkspaces,+    getAtom, spawn, spawnPID, xfork, getXMonadDir, recompile, trace, whenJust, whenX,     atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runQuery   ) where  import XMonad.StackSet hiding (modify)-import XMonad.PositionStore  import Prelude hiding ( catch )-import Control.Exception (catch, try, bracket, throw, finally, Exception(ExitException))+import Control.Exception.Extensible (catch, fromException, try, bracket, throw, finally, SomeException(..)) import Control.Applicative import Control.Monad.State import Control.Monad.Reader@@ -52,20 +52,25 @@ import Graphics.X11.Xlib.Extras (Event) import Data.Typeable import Data.List ((\\))-import Data.Maybe (isJust)+import Data.Maybe (isJust,fromMaybe) import Data.Monoid-import Data.Maybe (fromMaybe)  import qualified Data.Map as M import qualified Data.Set as S  -- | XState, the (mutable) window manager state. data XState = XState-    { windowset    :: !WindowSet           -- ^ workspace list-    , positionStore :: !(PositionStore Window) -- ^ preferred rectangles for windows-    , mapped       :: !(S.Set Window)      -- ^ the Set of mapped windows-    , waitingUnmap :: !(M.Map Window Int)  -- ^ the number of expected UnmapEvents-    , dragging     :: !(Maybe (Position -> Position -> X (), X ())) }+    { windowset        :: !WindowSet                     -- ^ workspace list+    , mapped           :: !(S.Set Window)                -- ^ the Set of mapped windows+    , waitingUnmap     :: !(M.Map Window Int)            -- ^ the number of expected UnmapEvents+    , dragging         :: !(Maybe (Position -> Position -> X (), X ()))+    , numberlockMask   :: !KeyMask                       -- ^ The numlock modifier+    , extensibleState  :: !(M.Map String (Either String StateExtension))+    -- ^ stores custom state information.+    --+    -- The module XMonad.Utils.ExtensibleState in xmonad-contrib+    -- provides additional information and a simple interface for using this.+    }  -- | XConf, the (read-only) window manager configuration. data XConf = XConf@@ -95,7 +100,6 @@                                                  -- should also be run afterwards. mappend should be used for combining                                                  -- event hooks in most cases.     , workspaces         :: ![String]            -- ^ The list of workspaces' names-    , numlockMask        :: !KeyMask             -- ^ The numlock modifier     , modMask            :: !KeyMask             -- ^ the mod modifier     , keys               :: !(XConfig Layout -> M.Map (ButtonMask,KeySym) (X ()))                                                  -- ^ The key binding: a map from key presses and actions@@ -167,9 +171,9 @@ catchX job errcase = do     st <- get     c <- ask-    (a, s') <- io $ runX c st job `catch` \e -> case e of-                            ExitException {} -> throw e-                            _ -> do hPrint stderr e; runX c st errcase+    (a, s') <- io $ runX c st job `catch` \e -> case fromException e of+                        Just x -> throw e `const` (x `asTypeOf` ExitSuccess)+                        _ -> do hPrint stderr e; runX c st errcase     put s'     return a @@ -194,11 +198,6 @@ withWindowSet :: (WindowSet -> X a) -> X a withWindowSet f = gets windowset >>= f -modifyPosStore :: (PositionStore Window -> PositionStore Window) -> X ()-modifyPosStore f = do-    XState { positionStore = posStore } <- get-    modify (\s -> s { positionStore = f posStore } )- -- | True if the given window is the root window isRoot :: Window -> X Bool isRoot w = (w==) <$> asks theRoot@@ -351,6 +350,33 @@ instance Message LayoutMessages  -- ---------------------------------------------------------------------+-- Extensible state+--++-- | Every module must make the data it wants to store+-- an instance of this class.+--+-- Minimal complete definition: initialValue+class Typeable a => ExtensionClass a where+    -- | Defines an initial value for the state extension+    initialValue :: a+    -- | Specifies whether the state extension should be+    -- persistent. Setting this method to 'PersistentExtension'+    -- will make the stored data survive restarts, but+    -- requires a to be an instance of Read and Show.+    --+    -- It defaults to 'StateExtension', i.e. no persistence.+    extensionType :: a -> StateExtension+    extensionType = StateExtension++-- | Existential type to store a state extension.+data StateExtension =+    forall a. ExtensionClass a => StateExtension a+    -- ^ Non-persistent state extension+  | forall a. (Read a, Show a, ExtensionClass a) => PersistentExtension a+    -- ^ Persistent extension++-- --------------------------------------------------------------------- -- | General utilities -- -- Lift an 'IO' action into the 'X' monad@@ -360,7 +386,7 @@ -- | Lift an 'IO' action into the 'X' monad.  If the action results in an 'IO' -- exception, log the exception to stderr and continue normal execution. catchIO :: MonadIO m => IO () -> m ()-catchIO f = io (f `catch` \e -> hPrint stderr e >> hFlush stderr)+catchIO f = io (f `catch` \(SomeException e) -> hPrint stderr e >> hFlush stderr)  -- | spawn. Launch an external application. Specifically, it double-forks and -- runs the 'String' you pass as a command to /bin/sh.@@ -369,10 +395,14 @@  -- | Like 'spawn', but returns the 'ProcessID' of the launched application spawnPID :: MonadIO m => String -> m ProcessID-spawnPID x = io . forkProcess . finally nullStdin $ do+spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", x] Nothing++-- | A replacement for 'forkProcess' which resets default signal handlers.+xfork :: MonadIO m => IO () -> m ProcessID+xfork x = io . forkProcess . finally nullStdin $ do                 uninstallSignalHandlers                 createSession-                executeFile "/bin/sh" False ["-c", x] Nothing+                x  where     nullStdin = do         fd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags@@ -422,11 +452,11 @@     libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib     srcT <- getModTime src     binT <- getModTime bin-    if (force || srcT > binT || any (binT<) libTs)+    if force || any (binT <) (srcT : libTs)       then do         -- temporarily disable SIGCHLD ignoring:         uninstallSignalHandlers-        status <- bracket (openFile err WriteMode) hClose $ \h -> do+        status <- bracket (openFile err WriteMode) hClose $ \h ->             waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir)                                     Nothing Nothing Nothing (Just h) @@ -446,11 +476,11 @@             return ()         return (status == ExitSuccess)       else return True- where getModTime f = catch (Just <$> getModificationTime f) (const $ return Nothing)+ where getModTime f = catch (Just <$> getModificationTime f) (\(SomeException _) -> return Nothing)        isSource = flip elem [".hs",".lhs",".hsc"]        allFiles t = do             let prep = map (t</>) . Prelude.filter (`notElem` [".",".."])-            cs <- prep <$> catch (getDirectoryContents t) (\_ -> return [])+            cs <- prep <$> catch (getDirectoryContents t) (\(SomeException _) -> return [])             ds <- filterM doesDirectoryExist cs             concat . ((cs \\ ds):) <$> mapM allFiles ds @@ -473,12 +503,14 @@ installSignalHandlers = io $ do     installHandler openEndedPipe Ignore Nothing     installHandler sigCHLD Ignore Nothing-    try $ fix $ \more -> do+    (try :: IO a -> IO (Either SomeException a))+      $ fix $ \more -> do         x <- getAnyProcessStatus False False         when (isJust x) more     return ()  uninstallSignalHandlers :: MonadIO m => m () uninstallSignalHandlers = io $ do+    installHandler openEndedPipe Default Nothing     installHandler sigCHLD Default Nothing     return ()
XMonad/Layout.hs view
@@ -52,8 +52,8 @@ -- | The builtin tiling mode of xmonad. Supports 'Shrink', 'Expand' and -- 'IncMasterN'. data Tall a = Tall { tallNMaster :: !Int               -- ^ The default number of windows in the master pane (default: 1)-                   , tallRatio :: !Rational            -- ^ Default proportion of screen occupied by master pane (default: 1/2)-                   , tallRatioIncrement :: !Rational } -- ^ Percent of screen to increment by when resizing panes (default: 3/100)+                   , tallRatioIncrement :: !Rational   -- ^ Percent of screen to increment by when resizing panes (default: 3/100)+                   , tallRatio :: !Rational }          -- ^ Default proportion of screen occupied by master pane (default: 1/2)                 deriving (Show, Read)                         -- TODO should be capped [0..1] .. @@ -125,7 +125,7 @@  -- | Mirror a rectangle. mirrorRect :: Rectangle -> Rectangle-mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)+mirrorRect (Rectangle rx ry rw rh) = Rectangle ry rx rh rw  ------------------------------------------------------------------------ -- LayoutClass selection manager@@ -173,7 +173,7 @@  instance (LayoutClass l a, LayoutClass r a) => LayoutClass (Choose l r) a where     runLayout (W.Workspace i (Choose L l r) ms) =-        fmap (second . fmap $ flip (Choose L) $ r) . runLayout (W.Workspace i l ms)+        fmap (second . fmap $ flip (Choose L) r) . runLayout (W.Workspace i l ms)     runLayout (W.Workspace i (Choose R l r) ms) =         fmap (second . fmap $ Choose R l) . runLayout (W.Workspace i r ms) @@ -194,7 +194,7 @@              R -> choose c R Nothing =<< handle r NextNoWrap -    handleMessage c@(Choose _ l _) m | Just FirstLayout <- fromMessage m = do        +    handleMessage c@(Choose _ l _) m | Just FirstLayout <- fromMessage m =         flip (choose c L) Nothing =<< handle l FirstLayout      handleMessage c@(Choose d l r) m | Just ReleaseResources <- fromMessage m =
XMonad/Main.hsc view
@@ -15,8 +15,10 @@  module XMonad.Main (xmonad) where +import Control.Arrow (second) import Data.Bits import Data.List ((\\))+import Data.Function import qualified Data.Map as M import qualified Data.Set as S import Control.Monad.Reader@@ -39,7 +41,6 @@ import XMonad.Operations  import System.IO---import System.Exit  ------------------------------------------------------------------------ -- Locale support@@ -67,42 +68,9 @@      rootw  <- rootWindow dpy dflt -    -- check for other WM-    wmSnAtom <- internAtom dpy ("WM_S" ++ (show dflt)) False-    currentWmSnOwner <- xGetSelectionOwner dpy wmSnAtom-    when (currentWmSnOwner /= 0) $ do-        putStrLn $ "Screen " ++ (show dflt) ++ " on display \""-                    ++ (displayString dpy) ++ "\" already has a window manager."-        -- exitFailure--        -- prepare to receive destroyNotify for old WM-        selectInput dpy currentWmSnOwner structureNotifyMask--        -- create off-screen window-        netWmSnOwner <- allocaSetWindowAttributes $ \attributes -> do-            set_override_redirect attributes True-            set_event_mask attributes propertyChangeMask-            let screen = defaultScreenOfDisplay dpy-            let visual = defaultVisualOfScreen screen-            let attrmask = cWOverrideRedirect .|. cWEventMask-            createWindow dpy rootw (-100) (-100) 1 1 0 copyFromParent copyFromParent visual attrmask attributes--        -- try to acquire wmSnAtom, this should signal the old WM to terminate-        putStrLn $ "Replacing existing window manager..."-        xSetSelectionOwner dpy wmSnAtom netWmSnOwner currentTime--        -- SKIPPED: check if we acquired the selection-        -- SKIPPED: send client message indicating that we are now the WM--        -- wait for old WM to go away-        putStr $ "Waiting for other window manager to terminate... "-        fix $ \again -> do-            evt <- allocaXEvent $ \event -> do-                windowEvent dpy currentWmSnOwner structureNotifyMask event-                get_EventType event+    args <- getArgs -            when (evt /= destroyNotify) again-        putStrLn $ "done"+    when ("--replace" `elem` args) $ replace dpy dflt rootw      -- If another WM is running, a BadAccess error will be returned.  The     -- default error handler will write the exception to stderr and exit with@@ -126,12 +94,10 @@                  return (fromMaybe fbc_ v)      hSetBuffering stdout NoBuffering-    args <- getArgs      let layout = layoutHook xmc         lreads = readsLayout layout         initialWinset = new layout (workspaces xmc) $ map SD xinesc-         maybeRead reads' s = case reads' s of                                 [(x, "")] -> Just x                                 _         -> Nothing@@ -141,6 +107,10 @@                     ws                   <- maybeRead reads s                     return . W.ensureTags layout (workspaces xmc)                            $ W.mapLayout (fromMaybe layout . maybeRead lreads) ws+        extState = fromMaybe M.empty $ do+                     ("--resume" : _ : dyns : _) <- return args+                     vals                        <- maybeRead reads dyns+                     return . M.fromList . map (second Left) $ vals          cf = XConf             { display       = dpy@@ -152,16 +122,19 @@             , buttonActions = mouseBindings xmc xmc             , mouseFocused  = False             , mousePosition = Nothing }-        st = XState-            { windowset     = initialWinset-            , positionStore = []-            , mapped        = S.empty-            , waitingUnmap  = M.empty-            , dragging      = Nothing } +        st = XState+            { windowset       = initialWinset+            , numberlockMask   = 0+            , mapped          = S.empty+            , waitingUnmap    = M.empty+            , dragging        = Nothing+            , extensibleState = extState+            }     allocaXEvent $ \e ->         runX cf st $ do +            setNumlockMask             grabKeys             grabButtons @@ -251,7 +224,9 @@ -- set keyboard mapping handle e@(MappingNotifyEvent {}) = do     io $ refreshKeyboardMapping e-    when (ev_request e == mappingKeyboard) grabKeys+    when (ev_request e `elem` [mappingKeyboard, mappingModifier]) $ do+        setNumlockMask+        grabKeys  -- handle button release, which may finish dragging. handle e@(ButtonEvent {ev_event_type = t})@@ -324,8 +299,9 @@ handle (ConfigureEvent {ev_window = w}) = whenX (isRoot w) rescreen  -- property notify-handle PropertyEvent { ev_event_type = t, ev_atom = a }-    | t == propertyNotify && a == wM_NAME = userCodeDef () =<< asks (logHook . config)+handle event@(PropertyEvent { ev_event_type = t, ev_atom = a })+    | t == propertyNotify && a == wM_NAME = asks (logHook . config) >>= userCodeDef () >>+                                         broadcastMessage event  handle e@ClientMessageEvent { ev_message_type = mt } = do     a <- getAtom "XMONAD_RESTART"@@ -357,6 +333,18 @@                   return $ not (wa_override_redirect wa)                          && (wa_map_state wa == waIsViewable || ic) +setNumlockMask :: X ()+setNumlockMask = do+    dpy <- asks display+    ms <- io $ getModifierMapping dpy+    xs <- sequence [ do+                        ks <- io $ keycodeToKeysym dpy kc 0+                        if ks == xK_Num_Lock+                            then return (setBit 0 (fromIntegral m))+                            else return (0 :: KeyMask)+                        | (m, kcs) <- ms, kc <- kcs, kc /= 0]+    modify (\s -> s { numberlockMask = foldr (.|.) 0 xs })+ -- | Grab the keys back grabKeys :: X () grabKeys = do@@ -368,7 +356,7 @@          kc <- io $ keysymToKeycode dpy sym          -- "If the specified KeySym is not defined for any KeyCode,          -- XKeysymToKeycode() returns zero."-         when (kc /= '\0') $ mapM_ (grab kc . (mask .|.)) =<< extraModifiers+         when (kc /= 0) $ mapM_ (grab kc . (mask .|.)) =<< extraModifiers  -- | XXX comment me grabButtons :: X ()@@ -380,3 +368,36 @@     ems <- extraModifiers     ba <- asks buttonActions     mapM_ (\(m,b) -> mapM_ (grab b . (m .|.)) ems) (M.keys $ ba)++-- | @replace@ to signals compliant window managers to exit.+replace :: Display -> ScreenNumber -> Window -> IO ()+replace dpy dflt rootw = do+    -- check for other WM+    wmSnAtom <- internAtom dpy ("WM_S" ++ show dflt) False+    currentWmSnOwner <- xGetSelectionOwner dpy wmSnAtom+    when (currentWmSnOwner /= 0) $ do+        -- prepare to receive destroyNotify for old WM+        selectInput dpy currentWmSnOwner structureNotifyMask++        -- create off-screen window+        netWmSnOwner <- allocaSetWindowAttributes $ \attributes -> do+            set_override_redirect attributes True+            set_event_mask attributes propertyChangeMask+            let screen = defaultScreenOfDisplay dpy+                visual = defaultVisualOfScreen screen+                attrmask = cWOverrideRedirect .|. cWEventMask+            createWindow dpy rootw (-100) (-100) 1 1 0 copyFromParent copyFromParent visual attrmask attributes++        -- try to acquire wmSnAtom, this should signal the old WM to terminate+        xSetSelectionOwner dpy wmSnAtom netWmSnOwner currentTime++        -- SKIPPED: check if we acquired the selection+        -- SKIPPED: send client message indicating that we are now the WM++        -- wait for old WM to go away+        fix $ \again -> do+            evt <- allocaXEvent $ \event -> do+                windowEvent dpy currentWmSnOwner structureNotifyMask event+                get_EventType event++            when (evt /= destroyNotify) again
XMonad/ManageHook.hs view
@@ -22,7 +22,7 @@ import XMonad.Core import Graphics.X11.Xlib.Extras import Graphics.X11.Xlib (Display, Window, internAtom, wM_NAME)-import Control.Exception (bracket, catch)+import Control.Exception.Extensible (bracket, catch, SomeException(..)) import Control.Monad.Reader import Data.Maybe import Data.Monoid@@ -37,8 +37,8 @@ idHook :: ManageHook idHook = doF id --- | Compose two 'ManageHook's.-(<+>) :: ManageHook -> ManageHook -> ManageHook+-- | Infix 'mappend'. Compose two 'ManageHook' from right to left.+(<+>) :: Monoid m => m -> m -> m (<+>) = mappend  -- | Compose the list of 'ManageHook's.@@ -72,10 +72,10 @@     let         getProp =             (internAtom d "_NET_WM_NAME" False >>= getTextProperty d w)-                `catch` \_ -> getTextProperty d w wM_NAME+                `catch` \(SomeException _) -> getTextProperty d w wM_NAME         extract prop = do l <- wcTextPropertyToTextList d prop                           return $ if null l then "" else head l-    io $ bracket getProp (xFree . tp_value) extract `catch` \_ -> return ""+    io $ bracket getProp (xFree . tp_value) extract `catch` \(SomeException _) -> return ""  -- | Return the application name. appName :: Query String
XMonad/Operations.hs view
@@ -21,7 +21,6 @@ import XMonad.Core import XMonad.Layout (Full(..)) import qualified XMonad.StackSet as W-import XMonad.PositionStore  import Data.Maybe import Data.Monoid          (Endo(..))@@ -34,14 +33,12 @@ import Control.Applicative import Control.Monad.Reader import Control.Monad.State-import qualified Control.Exception as C+import qualified Control.Exception.Extensible as C -import System.IO import System.Posix.Process (executeFile) import Graphics.X11.Xlib import Graphics.X11.Xinerama (getScreenInfo) import Graphics.X11.Xlib.Extras-import System.Random(randomRIO)  -- --------------------------------------------------------------------- -- |@@ -70,16 +67,14 @@             where i = W.tag $ W.workspace $ W.current ws      mh <- asks (manageHook . config)-    g <- fmap appEndo $ userCodeDef (Endo id) (runQuery mh w)+    g <- appEndo <$> userCodeDef (Endo id) (runQuery mh w)     windows (g . f)  -- | unmanage. A window no longer exists, remove it from the window -- list, on whatever workspace it is. -- unmanage :: Window -> X ()-unmanage w = do-    modifyPosStore (\ps -> posStoreRemove ps w)-    windows . W.delete $ w+unmanage = windows . W.delete  -- | Kill the specified window. If we do kill it, we'll get a -- delete notify back from X.@@ -116,7 +111,6 @@     XConf { display = d , normalBorder = nbc, focusedBorder = fbc } <- ask      mapM_ setInitialProperties newwindows-    mapM_ positionStoreInit newwindows      whenJust (W.peek old) $ \otherw -> io $ setWindowBorder d otherw nbc     modify (\s -> s { windowset = ws })@@ -150,23 +144,23 @@                     , Just r <- [M.lookup fw m]]             vs = flt ++ rs +        io $ restackWindows d (map fst vs)         -- return the visible windows for this workspace:         return vs      let visible = map fst rects -    io $ restackWindows d visible     mapM_ (uncurry tileWindow) rects      whenJust (W.peek ws) $ \w -> io $ setWindowBorder d w fbc +    mapM_ reveal visible+    setTopFocus+     -- hide every window that was potentially visible before, but is not     -- given a position by a layout now.     mapM_ hide (nub (oldvisible ++ newwindows) \\ visible) -    mapM_ reveal visible-    setTopFocus-     -- all windows that are no longer in the windowset are marked as     -- withdrawn, it is important to do this after the above, otherwise 'hide'     -- will overwrite withdrawnState with iconicState@@ -212,35 +206,11 @@ clientMask :: EventMask clientMask = structureNotifyMask .|. enterWindowMask .|. propertyChangeMask -positionStoreInit :: Window -> X ()-positionStoreInit w = withDisplay $ \d -> do-        wa <- io $ getWindowAttributes d w-        ws <- gets windowset-        arbitraryOffsetX :: Int <- io $ randomRIO (42, 242)-        arbitraryOffsetY :: Int <- io $ randomRIO (42, 242)-        if (wa_x wa == 0) && (wa_y wa == 0)-            then do-                let sr@(Rectangle srX srY _ _) = screenRect . W.screenDetail . W.current $ ws-                modifyPosStore (\ps -> posStoreInsert ps w-                                        (Rectangle (srX + fi arbitraryOffsetX)-                                                   (srY + fi arbitraryOffsetY)-                                                    (fi $ wa_width wa)-                                                    (fi $ wa_height wa)) sr )-            else do-                sc <- fromMaybe (W.current ws) <$> pointScreen (fi $ wa_x wa) (fi $ wa_y wa)-                let sr = screenRect . W.screenDetail $ sc-                modifyPosStore (\ps -> posStoreInsert ps w-                                        (Rectangle (fi $ wa_x wa) (fi $ wa_y wa)-                                            (fi $ wa_width wa) (fi $ wa_height wa)) sr )-    where-        fi :: (Integral a, Num b) => a -> b-        fi = fromIntegral- -- | Set some properties when we initially gain control of a window setInitialProperties :: Window -> X () setInitialProperties w = asks normalBorder >>= \nb -> withDisplay $ \d -> do     setWMState w iconicState-    io $ selectInput d w $ clientMask+    io $ selectInput d w clientMask     bw <- asks (borderWidth . config)     io $ setWindowBorderWidth d w bw     -- we must initially set the color of new windows, to maintain invariants@@ -350,14 +320,13 @@     dpy <- asks display      -- clear mouse button grab and border on other windows-    forM_ (W.current ws : W.visible ws) $ \wk -> do-        forM_ (W.index (W.view (W.tag (W.workspace wk)) ws)) $ \otherw -> do+    forM_ (W.current ws : W.visible ws) $ \wk ->+        forM_ (W.index (W.view (W.tag (W.workspace wk)) ws)) $ \otherw ->             setButtonGrab True otherw      -- If we ungrab buttons on the root window, we lose our mouse bindings.     whenX (not <$> isRoot w) $ setButtonGrab False w-    io $ do setInputFocus dpy w revertToPointerRoot 0-            -- raiseWindow dpy w+    io $ setInputFocus dpy w revertToPointerRoot 0  ------------------------------------------------------------------------ -- Message handling@@ -368,7 +337,7 @@ sendMessage a = do     w <- W.workspace . W.current <$> gets windowset     ml' <- handleMessage (W.layout w) (SomeMessage a) `catchX` return Nothing-    whenJust ml' $ \l' -> do+    whenJust ml' $ \l' ->         windows $ \ws -> ws { W.current = (W.current ws)                                 { W.workspace = (W.workspace $ W.current ws)                                   { W.layout = l' }}}@@ -418,18 +387,18 @@ -- (numlock and capslock) extraModifiers :: X [KeyMask] extraModifiers = do-    nlm <- asks (numlockMask . config)+    nlm <- gets numberlockMask     return [0, nlm, lockMask, nlm .|. lockMask ]  -- | Strip numlock\/capslock from a mask cleanMask :: KeyMask -> X KeyMask cleanMask km = do-    nlm <- asks (numlockMask . config)+    nlm <- gets numberlockMask     return (complement (nlm .|. lockMask) .&. km)  -- | Get the 'Pixel' value for a named color initColor :: Display -> String -> IO (Maybe Pixel)-initColor dpy c = C.handle (\_ -> return Nothing) $+initColor dpy c = C.handle (\(C.SomeException _) -> return Nothing) $     (Just . color_pixel . fst) <$> allocNamedColor dpy colormap c     where colormap = defaultColormap dpy (defaultScreen dpy) @@ -442,9 +411,13 @@ restart prog resume = do     broadcastMessage ReleaseResources     io . flush =<< asks display-    args <- if resume then gets (("--resume":) . return . showWs . windowset) else return []+    let wsData = show . W.mapLayout show . windowset+        maybeShow (t, Right (PersistentExtension ext)) = Just (t, show ext)+        maybeShow (t, Left str) = Just (t, str)+        maybeShow _ = Nothing+        extState = return . show . catMaybes . map maybeShow . M.toList . extensibleState+    args <- if resume then gets (\s -> "--resume":wsData s:extState s) else return []     catchIO (executeFile prog True args Nothing)- where showWs = show . W.mapLayout show  ------------------------------------------------------------------------ -- | Floating layer support@@ -464,7 +437,7 @@                             (fi (wa_width  wa + bw*2) % fi (rect_width sr))                             (fi (wa_height wa + bw*2) % fi (rect_height sr)) -    return (W.screen $ sc, rr)+    return (W.screen sc, rr)   where fi x = fromIntegral x  -- | Given a point, determine the screen (if any) that contains it.@@ -534,7 +507,7 @@     wa <- io $ getWindowAttributes d w     sh <- io $ getWMNormalHints d w     io $ warpPointer d none w 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa))-    mouseDrag (\ex ey -> do+    mouseDrag (\ex ey ->                  io $ resizeWindow d w `uncurry`                     applySizeHintsContents sh (ex - fromIntegral (wa_x wa),                                                ey - fromIntegral (wa_y wa)))
− XMonad/PositionStore.hs
@@ -1,59 +0,0 @@-------------------------------------------------------------------------------- |--- Module      :  XMonad.PositionStore--- Copyright   :  (c) Jan Vornberger 2009--- License     :  BSD3-style (see LICENSE)------ Maintainer  :  jan.vornberger@informatik.uni-oldenburg.de--- Stability   :  unstable--- Portability :  not portable-----------------------------------------------------------------------------------module XMonad.PositionStore (-        PositionStore,-        posStoreInsert,-        posStoreMove,-        posStoreQuery,-        posStoreRemove-    ) where--import Graphics.X11.Xlib---- Store window positions relative to the upper left screen edge--- and windows sizes as well as positions as fractions of the screen size.--- This way windows can be easily relocated and scaled when switching screens.--type PositionStore a = [(a, PosStoreRectangle)]-data PosStoreRectangle = PSRectangle Double Double Double Double--posStoreInsert :: (Eq a) => PositionStore a -> a -> Rectangle -> Rectangle -> PositionStore a-posStoreInsert posStore w (Rectangle x y wh ht) (Rectangle srX srY srWh srHt) =-    let offsetX = x - srX-        offsetY = y - srY-    in posStoreInsert' posStore w (PSRectangle (fromIntegral offsetX / fromIntegral srWh)-                                               (fromIntegral offsetY / fromIntegral srHt)-                                               (fromIntegral wh / fromIntegral srWh)-                                               (fromIntegral ht / fromIntegral srHt))--posStoreInsert' :: (Eq a) => PositionStore a -> a -> PosStoreRectangle -> PositionStore a-posStoreInsert' posStore w psRect = (w, psRect) : (posStoreRemove posStore w)--posStoreRemove :: (Eq a) => PositionStore a -> a -> PositionStore a-posStoreRemove posStore w = filter (\(w', _) -> w /= w') posStore--posStoreQuery :: (Eq a) => PositionStore a -> a -> Rectangle -> Maybe Rectangle-posStoreQuery posStore w (Rectangle srX srY srWh srHt) = do-    (PSRectangle x y wh ht) <- lookup w posStore-    let realWh = fromIntegral srWh * wh-        realHt = fromIntegral srHt * ht-        realOffsetX = fromIntegral srWh * x-        realOffsetY = fromIntegral srHt * y-    return (Rectangle (srX + round realOffsetX) (srY + round realOffsetY)-                        (round realWh) (round realHt))--posStoreMove :: (Eq a) => PositionStore a -> a -> Position -> Position -> Rectangle -> Rectangle -> PositionStore a-posStoreMove posStore w x y oldSr newSr =-    case (posStoreQuery posStore w oldSr) of-        Nothing -> posStore     -- not in store, can't move -> do nothing-        Just (Rectangle _ _ wh ht) -> posStoreInsert posStore w (Rectangle x y wh ht) newSr
XMonad/StackSet.hs view
@@ -35,7 +35,7 @@         -- *  Operations on the current stack         -- $stackOperations         peek, index, integrate, integrate', differentiate,-        focusUp, focusDown, focusUp', focusDown', focusMaster, focusMaster', focusWindow,+        focusUp, focusDown, focusUp', focusDown', focusMaster, focusWindow,         tagMember, renameTag, ensureTags, member, findTag, mapWorkspace, mapLayout,         -- * Modifying the stackset         -- $modifyStackset@@ -52,7 +52,7 @@     ) where  import Prelude hiding (filter)-import Data.Maybe   (listToMaybe,isJust)+import Data.Maybe   (listToMaybe,isJust,fromMaybe) import qualified Data.List as L (deleteBy,find,splitAt,filter,nub) import Data.List ( (\\) ) import qualified Data.Map  as M (Map,insert,delete,empty)@@ -369,7 +369,7 @@ -- focusWindow :: (Eq s, Eq a, Eq i) => a -> StackSet i l a s sd -> StackSet i l a s sd focusWindow w s | Just w == peek s = s-                | otherwise        = maybe s id $ do+                | otherwise        = fromMaybe s $ do                     n <- findTag w s                     return $ until ((Just w ==) . peek) focusUp (view n s) @@ -524,13 +524,9 @@  -- | /O(s)/. Set focus to the master window. focusMaster :: StackSet i l a s sd -> StackSet i l a s sd-focusMaster = modify' focusMaster'---- | Variant of 'focusMaster' that works on a--- 'Stack' rather than an entire 'StackSet'.-focusMaster' :: Stack a -> Stack a-focusMaster' c@(Stack _ [] _) = c-focusMaster' (Stack t ls rs) = Stack x [] (xs ++ t : rs) where (x:xs) = reverse ls+focusMaster = modify' $ \c -> case c of+    Stack _ [] _  -> c+    Stack t ls rs -> Stack x [] (xs ++ t : rs) where (x:xs) = reverse ls  -- -- ---------------------------------------------------------------------
man/xmonad.1 view
@@ -1,134 +0,0 @@-./" man page created by David Lazar on April 24, 2007-./" uses ``tmac.an'' macro set-.TH xmonad 1 "18 April 07" xmonad\-1.0 "xmonad manual"-.SH NAME-xmonad \- a tiling window manager-.SH DESCRIPTION-.PP-\fBxmonad\fR is a minimalist tiling window manager for X, written in Haskell. Windows are managed using automatic layout algorithms, which can be dynamically reconfigured. At any time windows are arranged so as to maximise the use of screen real estate. All features of the window manager are accessible purely from the keyboard: a mouse is entirely optional. \fBxmonad\fR is configured in Haskell, and custom layout algorithms may be implemented by the user in config files. A principle of \fBxmonad\fR is predictability: the user should know in advance precisely the window arrangement that will result from any action.-.PP-By default, \fBxmonad\fR provides three layout algorithms: tall, wide and fullscreen. In tall or wide mode, windows are tiled and arranged to prevent overlap and maximise screen use. Sets of windows are grouped together on virtual screens, and each screen retains its own layout, which may be reconfigured dynamically. Multiple physical monitors are supported via Xinerama, allowing simultaneous display of a number of screens.-.PP-By utilising the expressivity of a modern functional language with a rich static type system, \fBxmonad\fR provides a complete, featureful window manager in less than 1200 lines of code, with an emphasis on correctness and robustness. Internal properties of the window manager are checked using a combination of static guarantees provided by the type system, and type-based automated testing. A benefit of this is that the code is simple to understand, and easy to modify.-.SH USAGE-.PP-\fBxmonad\fR places each window into a "workspace". Each workspace can have any number of windows, which you can cycle though with mod-j and mod-k. Windows are either displayed full screen, tiled horizontally, or tiled vertically. You can toggle the layout mode with mod-space, which will cycle through the available modes.-.PP-You can switch to workspace N with mod-N. For example, to switch to workspace 5, you would press mod-5. Similarly, you can move the current window to another workspace with mod-shift-N.-.PP-When running with multiple monitors (Xinerama), each screen has exactly 1 workspace visible. mod-{w,e,r} switch the focus between screens, while shift-mod-{w,e,r} move the current window to that screen. When \fBxmonad\fR starts, workspace 1 is on screen 1, workspace 2 is on screen 2, etc. When switching workspaces to one that is already visible, the current and visible workspaces are swapped.-.PP-.SS Flags-\fBxmonad\fR has several flags which you may pass to the executable. These flags are:-.TP-\fB--recompile-Recompiles your configuration in ~/.xmonad/xmonad.hs-\fB--restart-Causes the currently running xmonad process to restart-.TP-\fB--version-Display version of \fBxmonad\fR.-.SS Default keyboard bindings-.IP- \fBmod-shift-return\fR-Launch terminal-.IP- \fBmod-p\fR-Launch dmenu-.IP- \fBmod-shift-p\fR-Launch gmrun-.IP- \fBmod-shift-c\fR-Close the focused window-.IP- \fBmod-space\fR-Rotate through the available layout algorithms-.IP- \fBmod-shift-space\fR-Reset the layouts on the current workspace to default-.IP- \fBmod-n\fR-Resize viewed windows to the correct size-.IP- \fBmod-tab\fR-Move focus to the next window-.IP- \fBmod-shift-tab\fR-Move focus to the previous window-.IP- \fBmod-j\fR-Move focus to the next window-.IP- \fBmod-k\fR-Move focus to the previous window-.IP- \fBmod-m\fR-Move focus to the master window-.IP- \fBmod-return\fR-Swap the focused window and the master window-.IP- \fBmod-shift-j\fR-Swap the focused window with the next window-.IP- \fBmod-shift-k\fR-Swap the focused window with the previous window-.IP- \fBmod-h\fR-Shrink the master area-.IP- \fBmod-l\fR-Expand the master area-.IP- \fBmod-t\fR-Push window back into tiling-.IP- \fBmod-comma\fR-Increment the number of windows in the master area-.IP- \fBmod-period\fR-Deincrement the number of windows in the master area-.IP- \fBmod-b\fR-Toggle the status bar gap-.IP- \fBmod-shift-q\fR-Quit xmonad-.IP- \fBmod-q\fR-Restart xmonad-.IP- \fBmod-[1..9]\fR-Switch to workspace N-.IP- \fBmod-shift-[1..9]\fR-Move client to workspace N-.IP- \fBmod-{w,e,r}\fR-Switch to physical/Xinerama screens 1, 2, or 3-.IP- \fBmod-shift-{w,e,r}\fR-Move client to screen 1, 2, or 3-.IP- \fBmod-button1\fR-Set the window to floating mode and move by dragging-.IP- \fBmod-button2\fR-Raise the window to the top of the stack-.IP- \fBmod-button3\fR-Set the window to floating mode and resize by dragging--.SH EXAMPLES-To use \fBxmonad\fR as your window manager add:-.RS-xmonad-.RE-to your \fI~/.xinitrc\fR file-.SH CUSTOMIZATION-\fBxmonad\fR is customized in ~/.xmonad/xmonad.hs, and then restarting with mod-q.-.PP-You can find many extensions to the core feature set in the xmonad-contrib package, available through your package manager or from http://xmonad.org/.-.SH BUGS-Probably. If you find any, please report them: http://code.google.com/p/xmonad/issues/list
+ man/xmonad.1.html view
− man/xmonad.1.in
@@ -1,44 +0,0 @@-./" man page created by David Lazar on April 24, 2007-./" uses ``tmac.an'' macro set-.TH xmonad 1 "18 April 07" xmonad\-1.0 "xmonad manual"-.SH NAME-xmonad \- a tiling window manager-.SH DESCRIPTION-.PP-\fBxmonad\fR is a minimalist tiling window manager for X, written in Haskell. Windows are managed using automatic layout algorithms, which can be dynamically reconfigured. At any time windows are arranged so as to maximise the use of screen real estate. All features of the window manager are accessible purely from the keyboard: a mouse is entirely optional. \fBxmonad\fR is configured in Haskell, and custom layout algorithms may be implemented by the user in config files. A principle of \fBxmonad\fR is predictability: the user should know in advance precisely the window arrangement that will result from any action.-.PP-By default, \fBxmonad\fR provides three layout algorithms: tall, wide and fullscreen. In tall or wide mode, windows are tiled and arranged to prevent overlap and maximise screen use. Sets of windows are grouped together on virtual screens, and each screen retains its own layout, which may be reconfigured dynamically. Multiple physical monitors are supported via Xinerama, allowing simultaneous display of a number of screens.-.PP-By utilising the expressivity of a modern functional language with a rich static type system, \fBxmonad\fR provides a complete, featureful window manager in less than 1200 lines of code, with an emphasis on correctness and robustness. Internal properties of the window manager are checked using a combination of static guarantees provided by the type system, and type-based automated testing. A benefit of this is that the code is simple to understand, and easy to modify.-.SH USAGE-.PP-\fBxmonad\fR places each window into a "workspace". Each workspace can have any number of windows, which you can cycle though with mod-j and mod-k. Windows are either displayed full screen, tiled horizontally, or tiled vertically. You can toggle the layout mode with mod-space, which will cycle through the available modes.-.PP-You can switch to workspace N with mod-N. For example, to switch to workspace 5, you would press mod-5. Similarly, you can move the current window to another workspace with mod-shift-N.-.PP-When running with multiple monitors (Xinerama), each screen has exactly 1 workspace visible. mod-{w,e,r} switch the focus between screens, while shift-mod-{w,e,r} move the current window to that screen. When \fBxmonad\fR starts, workspace 1 is on screen 1, workspace 2 is on screen 2, etc. When switching workspaces to one that is already visible, the current and visible workspaces are swapped.-.PP-.SS Flags-\fBxmonad\fR has several flags which you may pass to the executable. These flags are:-.TP-\fB--recompile-Recompiles your configuration in ~/.xmonad/xmonad.hs-\fB--restart-Causes the currently running xmonad process to restart-.TP-\fB--version-Display version of \fBxmonad\fR.-.SS Default keyboard bindings-___KEYBINDINGS___-.SH EXAMPLES-To use \fBxmonad\fR as your window manager add:-.RS-xmonad-.RE-to your \fI~/.xinitrc\fR file-.SH CUSTOMIZATION-\fBxmonad\fR is customized in ~/.xmonad/xmonad.hs, and then restarting with mod-q.-.PP-You can find many extensions to the core feature set in the xmonad-contrib package, available through your package manager or from http://xmonad.org/.-.SH BUGS-Probably. If you find any, please report them: http://code.google.com/p/xmonad/issues/list
+ man/xmonad.1.markdown view
@@ -0,0 +1,102 @@+#Name+xmonad - a tiling window manager++#Description++_xmonad_ is a minimalist tiling window manager for X, written in Haskell.+Windows are managed using automatic layout algorithms, which can be+dynamically reconfigured. At any time windows are arranged so as to+maximize the use of screen real estate. All features of the window manager+are accessible purely from the keyboard: a mouse is entirely optional.+_xmonad_ is configured in Haskell, and custom layout algorithms may be+implemented by the user in config files. A principle of _xmonad_ is+predictability: the user should know in advance precisely the window+arrangement that will result from any action.++By default, _xmonad_ provides three layout algorithms: tall, wide and+fullscreen. In tall or wide mode, windows are tiled and arranged to prevent+overlap and maximize screen use. Sets of windows are grouped together on+virtual screens, and each screen retains its own layout, which may be+reconfigured dynamically. Multiple physical monitors are supported via+Xinerama, allowing simultaneous display of a number of screens.++By utilizing the expressivity of a modern functional language with a rich+static type system, _xmonad_ provides a complete, featureful window manager+in less than 1200 lines of code, with an emphasis on correctness and+robustness. Internal properties of the window manager are checked using a+combination of static guarantees provided by the type system, and+type-based automated testing. A benefit of this is that the code is simple+to understand, and easy to modify.++#Usage++_xmonad_ places each window into a "workspace". Each workspace can have+any number of windows, which you can cycle though with mod-j and mod-k.+Windows are either displayed full screen, tiled horizontally, or tiled+vertically. You can toggle the layout mode with mod-space, which will cycle+through the available modes.++You can switch to workspace N with mod-N. For example, to switch to+workspace 5, you would press mod-5. Similarly, you can move the current+window to another workspace with mod-shift-N.++When running with multiple monitors (Xinerama), each screen has exactly 1+workspace visible. mod-{w,e,r} switch the focus between screens, while+shift-mod-{w,e,r} move the current window to that screen. When _xmonad_+starts, workspace 1 is on screen 1, workspace 2 is on screen 2, etc. When+switching workspaces to one that is already visible, the current and+visible workspaces are swapped.++##Flags+xmonad  has  several flags which  you may pass to the executable.+These flags are:++--recompile+:   Recompiles your configuration in _~/.xmonad/xmonad.hs_++--restart+:   Causes the currently running _xmonad_ process to restart++--replace+:   Replace the current window manager with xmonad++--version+:   Display version of _xmonad_++--verbose-version+:   Display detailed version of _xmonad_++##Default keyboard bindings++___KEYBINDINGS___++#Examples+To use xmonad as your window manager add to your _~/.xinitrc_ file:++> exec xmonad++#Customization+xmonad is customized in ~/.xmonad/xmonad.hs,  and  then  restarting+with mod-q.++You can find many extensions to the core feature set in the xmonad-+contrib package, available through your  package  manager  or  from+[xmonad.org].++##Modular Configuration+As of _xmonad-0.9_, any additional Haskell modules may be placed in+_~/.xmonad/lib/_ are available in GHC's searchpath. Hierarchical modules+are supported: for example, the file+_~/.xmonad/lib/XMonad/Stack/MyAdditions.hs_ could contain:++> module XMonad.Stack.MyAdditions (function1) where+>     function1 = error "function1: Not implemented yet!"++Your xmonad.hs may then import XMonad.Stack.MyAdditions as if that+module was contained within xmonad or xmonad-contrib.++#Bugs+Probably. If you find any, please report them to the [bugtracker]++[xmonad.org]: http://xmonad.org+[bugtracker]: http://code.google.com/p/xmonad/issues/list
man/xmonad.hs view
@@ -34,21 +34,6 @@ -- myModMask       = mod1Mask --- The mask for the numlock key. Numlock status is "masked" from the--- current modifier status, so the keybindings will work with numlock on or--- off. You may need to change this on some systems.------ You can find the numlock modifier by running "xmodmap" and looking for a--- modifier with Num_Lock bound to it:------ > $ xmodmap | grep Num--- > mod2        Num_Lock (0x4d)------ Set numlockMask = 0 if you don't have a numlock key, or want to treat--- numlock status separately.----myNumlockMask   = mod2Mask- -- The default number of workspaces (virtual screens) and their names. -- By default we use numeric strings, but any string may be used as a -- workspace name. The number of workspaces is determined by the length@@ -239,11 +224,7 @@ -- Status bars and logging  -- Perform an arbitrary action on each internal state change or X event.--- See the 'DynamicLog' extension for examples.------ To emulate dwm's status bar------ > logHook = dynamicLogDzen+-- See the 'XMonad.Hooks.DynamicLog' extension for examples. -- myLogHook = return () @@ -276,7 +257,6 @@         focusFollowsMouse  = myFocusFollowsMouse,         borderWidth        = myBorderWidth,         modMask            = myModMask,-        numlockMask        = myNumlockMask,         workspaces         = myWorkspaces,         normalBorderColor  = myNormalBorderColor,         focusedBorderColor = myFocusedBorderColor,
− man/xmonad.html
tests/Properties.hs view
@@ -14,7 +14,7 @@ import Data.Maybe import System.Environment import Control.Exception    (assert)-import qualified Control.Exception as C+import qualified Control.Exception.Extensible as C import Control.Monad import Test.QuickCheck hiding (promote) import System.IO.Unsafe@@ -613,13 +613,13 @@  -- and help out hpc prop_abort x = unsafePerformIO $ C.catch (abort "fail")-                                         (\e -> return $  show e == "xmonad: StackSet: fail" )+                                         (\(C.SomeException e) -> return $  show e == "xmonad: StackSet: fail" )    where      _ = x :: Int  -- new should fail with an abort prop_new_abort x = unsafePerformIO $ C.catch f-                                         (\e -> return $ show e == "xmonad: StackSet: non-positive argument to StackSet.new" )+                                         (\(C.SomeException e) -> return $ show e == "xmonad: StackSet: non-positive argument to StackSet.new" )    where      f = new undefined{-layout-} [] [] `seq` return False 
tests/loc.hs view
@@ -5,9 +5,9 @@           let actual_loc = filter (not.null) $ filter isntcomment $                            map (dropWhile (==' ')) $ lines foo               loc = length actual_loc-          putStrLn $ show loc+          print loc           -- uncomment the following to check for mistakes in isntcomment-          -- putStr $ unlines $ actual_loc+          -- print actual_loc  isntcomment ('-':'-':_) = False isntcomment ('{':'-':_) = False -- pragmas
util/GenerateManpage.hs view
@@ -1,7 +1,14 @@+-- Unlike the rest of xmonad, this file is copyright under the terms of the+-- GPL.+ -- -- Generates man/xmonad.1 from man/xmonad.1.in by filling the list of -- keybindings with values scraped from Config.hs --+-- Uses cabal to grab the xmonad version from xmonad.cabal+--+-- Uses pandoc to convert the "xmonad.1.markdown" to "xmonad.1"+-- -- Format for the docstrings in Config.hs takes the following form: -- -- -- mod-x %! Frob the whatsit@@ -14,12 +21,23 @@ -- [ ((modMask .|. shiftMask, xK_Return), spawn "xterm") -- %! Launch an xterm -- -- Here, mod-shift-return will be used as the keybinding name.--- import Control.Monad+import Control.Applicative import Text.Regex.Posix import Data.Char import Data.List +import Distribution.PackageDescription.Parse+import Distribution.Verbosity+import Distribution.Package+import Distribution.PackageDescription+import Text.PrettyPrint.HughesPJ+import Distribution.Text++import Text.Pandoc++releaseDate = "25 October 09"+ trim :: String -> String trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace @@ -35,13 +53,42 @@ allBindings xs = map (binding . map trim) (xs =~ "(.*)--(.*)%!(.*)")  -- FIXME: What escaping should we be doing on these strings?-troff :: (String, String) -> String-troff (key, desc) = ".IP\n \\fB" ++ key ++ "\\fR\n" ++ desc ++ "\n"+markdownDefn :: (String, String) -> String+markdownDefn (key, desc) = key ++ "\n:     " ++ desc  replace :: Eq a => a -> a -> [a] -> [a] replace x y = map (\a -> if a == x then y else a) +-- rawSystem "pandoc" ["--read=markdown","--write=man","man/xmonad.1.markdown"]+ main = do-    troffBindings <- (concatMap troff . allBindings) `liftM` readFile "./XMonad/Config.hs"-    let sed = unlines . replace "___KEYBINDINGS___" troffBindings . lines-    readFile "./man/xmonad.1.in" >>= return . sed >>= writeFile "./man/xmonad.1"+    releaseName <- (show . disp . package . packageDescription)+                    `liftM`readPackageDescription normal "xmonad.cabal"+    keybindings <- (intercalate "\n\n" . map markdownDefn . allBindings)+                    `liftM` readFile "./XMonad/Config.hs"++    let manHeader = unwords [".TH xmonad 1","\""++releaseDate++"\"",releaseName,"\"xmonad manual\""]+        writeOpts = defaultWriterOptions -- { writerLiterateHaskell = True }++    parsed <- readMarkdown defaultParserState { stateLiterateHaskell = True }+        . unlines+        . replace "___KEYBINDINGS___" keybindings+        . lines+        <$> readFile "./man/xmonad.1.markdown"++    writeFile "./man/xmonad.1"+        . (manHeader ++)+        . writeMan writeOpts+        $ parsed+    putStrLn "Documentation created: man/xmonad.1"++    writeFile "./man/xmonad.1.html"+        . writeHtmlString writeOpts+            { writerHeader = "<h1>"++releaseName++"</h1>"+++                             "<p>Section: xmonad manual (1)<br>"+++                             "Updated: "++releaseDate++"</p>"+++                             "<hr>"+            , writerStandalone = True+            , writerTableOfContents = True }+        $ parsed+    putStrLn "Documentation created: man/xmonad.1.html"
xmonad-bluetilebranch.cabal view
@@ -1,5 +1,5 @@ name:               xmonad-bluetilebranch-version:            0.8.1.3+version:            0.9.1.4 homepage:           http://xmonad.org synopsis:           A tiling window manager description:        This is a modified version of xmonad used by Bluetile.@@ -9,11 +9,13 @@ author:             Spencer Janssen maintainer:         jan.vornberger@informatik.uni-oldenburg.de extra-source-files: README TODO CONFIG STYLE tests/loc.hs tests/Properties.hs-                    man/xmonad.1.in man/xmonad.1 man/xmonad.html man/xmonad.hs+                    man/xmonad.1.markdown man/xmonad.1 man/xmonad.1.html                     util/GenerateManpage.hs cabal-version:      >= 1.2 build-type:         Simple +data-files:         man/xmonad.hs+ flag small_base     description: Choose the new smaller, split-up base package. @@ -29,17 +31,21 @@                         XMonad.Layout                         XMonad.ManageHook                         XMonad.Operations-                        XMonad.PositionStore                         XMonad.StackSet     exposed:            False      if flag(small_base)-        build-depends: base < 4 && >=3, containers, directory, process, filepath+        build-depends: base < 5 && >=3, containers, directory, process, filepath, extensible-exceptions     else         build-depends: base < 3-    build-depends: X11>=1.4.3, mtl, unix, random+    build-depends: X11>=1.5.0.0 && < 1.6, mtl, unix -    ghc-options:        -funbox-strict-fields -Wall+    if true+        ghc-options:        -funbox-strict-fields -Wall++    if impl(ghc >= 6.12.1)+        ghc-options:        -fno-warn-unused-do-bind+     ghc-prof-options:   -prof -auto-all     extensions:         CPP @@ -55,10 +61,14 @@                         XMonad.Layout                         XMonad.ManageHook                         XMonad.Operations-                        XMonad.PositionStore                         XMonad.StackSet -    ghc-options:        -funbox-strict-fields -Wall+    if true +        ghc-options:    -funbox-strict-fields -Wall++    if impl(ghc >= 6.12.1)+        ghc-options:    -fno-warn-unused-do-bind+     ghc-prof-options:   -prof -auto-all     extensions:         CPP @@ -67,7 +77,5 @@         hs-source-dirs: . tests/         build-depends:  QuickCheck < 2         ghc-options:    -Werror-    else-        buildable: False     if flag(testing) && flag(small_base)-        build-depends:  random+        build-depends:  filepath, process, directory, mtl, unix, X11, base, containers, random, extensible-exceptions