mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-05 22:51:54 -07:00
comments, move isRoot into XMonad
This commit is contained in:
4
Main.hs
4
Main.hs
@@ -270,10 +270,6 @@ setTopFocus = do
|
|||||||
Just new -> setFocus new
|
Just new -> setFocus new
|
||||||
Nothing -> gets theRoot >>= setFocus
|
Nothing -> gets theRoot >>= setFocus
|
||||||
|
|
||||||
-- | True if the given window is the root window
|
|
||||||
isRoot :: Window -> X Bool
|
|
||||||
isRoot w = liftM (w==) (gets theRoot)
|
|
||||||
|
|
||||||
-- | raise. focus to window at offset 'n' in list.
|
-- | raise. focus to window at offset 'n' in list.
|
||||||
-- The currently focused window is always the head of the list
|
-- The currently focused window is always the head of the list
|
||||||
raise :: Ordering -> X ()
|
raise :: Ordering -> X ()
|
||||||
|
14
XMonad.hs
14
XMonad.hs
@@ -15,7 +15,9 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
module XMonad (
|
module XMonad (
|
||||||
X, WorkSpace, XState(..),runX, withDisplay, io, spawn, trace, whenJust
|
X, WorkSpace, XState(..),runX,
|
||||||
|
io, withDisplay, isRoot,
|
||||||
|
spawn, trace, whenJust
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import StackSet (StackSet)
|
import StackSet (StackSet)
|
||||||
@@ -49,11 +51,19 @@ newtype X a = X (StateT XState IO a)
|
|||||||
runX :: XState -> X a -> IO ()
|
runX :: XState -> X a -> IO ()
|
||||||
runX st (X a) = runStateT a st >> return ()
|
runX st (X a) = runStateT a st >> return ()
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Convenient wrappers to state
|
||||||
|
|
||||||
-- | Run a monad action with the current display settings
|
-- | Run a monad action with the current display settings
|
||||||
withDisplay :: (Display -> X ()) -> X ()
|
withDisplay :: (Display -> X ()) -> X ()
|
||||||
withDisplay f = gets display >>= f
|
withDisplay f = gets display >>= f
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
-- | True if the given window is the root window
|
||||||
|
isRoot :: Window -> X Bool
|
||||||
|
isRoot w = liftM (w==) (gets theRoot)
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Utilities
|
||||||
|
|
||||||
-- | Lift an IO action into the X monad
|
-- | Lift an IO action into the X monad
|
||||||
io :: IO a -> X a
|
io :: IO a -> X a
|
||||||
|
Reference in New Issue
Block a user