aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2012-11-09 02:23:16 +0100
committerAdam Vogt <vogt.adam@gmail.com>2012-11-09 02:23:16 +0100
commitfff5ddb53f4eda07c3cbd1caae236e5edd8ea4bc (patch)
tree9f158730016f24578b11960dee6a7dcb11961e38
parentf1c0b28a5c40186f8723772a9e30d1107a4c884b (diff)
downloadXMonadContrib-fff5ddb53f4eda07c3cbd1caae236e5edd8ea4bc.tar.gz
XMonadContrib-fff5ddb53f4eda07c3cbd1caae236e5edd8ea4bc.tar.xz
XMonadContrib-fff5ddb53f4eda07c3cbd1caae236e5edd8ea4bc.zip
Rename variables "state" to avoid warnings about shadowing
Ignore-this: cd063d632412f758ca9fed6393521c8f XMonad core re-exports Control.Monad.State, which includes a function "state" if you happen to use mtl-2. Since there's a chance xmonad still works with mtl-1 avoid imports like: import XMonad hiding (state) darcs-hash:20121109012316-1499c-539514f4cd97ba8b18a8fbfd1a15333b46d962e1.gz
-rw-r--r--XMonad/Actions/Plane.hs4
-rw-r--r--XMonad/Hooks/DynamicBars.hs6
-rw-r--r--XMonad/Hooks/EwmhDesktops.hs8
-rw-r--r--XMonad/Layout/Fullscreen.hs14
-rw-r--r--XMonad/Layout/MouseResizableTile.hs74
-rw-r--r--XMonad/Layout/WindowNavigation.hs10
6 files changed, 58 insertions, 58 deletions
diff --git a/XMonad/Actions/Plane.hs b/XMonad/Actions/Plane.hs
index 8126d41..3037719 100644
--- a/XMonad/Actions/Plane.hs
+++ b/XMonad/Actions/Plane.hs
@@ -110,7 +110,7 @@ plane ::
(WorkspaceId -> WindowSet -> WindowSet) -> Lines -> Limits -> Direction ->
X ()
plane function numberLines_ limits direction = do
- state <- get
+ st <- get
xconf <- ask
numberLines <-
@@ -205,7 +205,7 @@ plane function numberLines_ limits direction = do
preColumns = div areas numberLines
mCurrentWS :: Maybe Int
- mCurrentWS = elemIndex (currentTag $ windowset state) areaNames
+ mCurrentWS = elemIndex (currentTag $ windowset st) areaNames
areas :: Int
areas = length areaNames
diff --git a/XMonad/Hooks/DynamicBars.hs b/XMonad/Hooks/DynamicBars.hs
index d8c40fe..993aec5 100644
--- a/XMonad/Hooks/DynamicBars.hs
+++ b/XMonad/Hooks/DynamicBars.hs
@@ -112,11 +112,11 @@ multiPP focusPP unfocusPP = do
multiPP' :: (PP -> X String) -> PP -> PP -> [Handle] -> X ()
multiPP' dynlStr focusPP unfocusPP handles = do
- state <- get
+ st <- get
let pickPP :: WorkspaceId -> WriterT (Last XState) X String
pickPP ws = do
- let isFoc = (ws ==) . W.tag . W.workspace . W.current $ windowset state
- put state{ windowset = W.view ws $ windowset state }
+ let isFoc = (ws ==) . W.tag . W.workspace . W.current $ windowset st
+ put st{ windowset = W.view ws $ windowset st }
out <- lift $ dynlStr $ if isFoc then focusPP else unfocusPP
when isFoc $ get >>= tell . Last . Just
return out
diff --git a/XMonad/Hooks/EwmhDesktops.hs b/XMonad/Hooks/EwmhDesktops.hs
index b3bed77..060079a 100644
--- a/XMonad/Hooks/EwmhDesktops.hs
+++ b/XMonad/Hooks/EwmhDesktops.hs
@@ -170,9 +170,9 @@ handle _ _ = return ()
-- Note this is not included in 'ewmh'.
fullscreenEventHook :: Event -> X All
fullscreenEventHook (ClientMessageEvent _ _ _ dpy win typ (action:dats)) = do
- state <- getAtom "_NET_WM_STATE"
+ wmstate <- getAtom "_NET_WM_STATE"
fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN"
- wstate <- fromMaybe [] `fmap` getProp32 state win
+ wstate <- fromMaybe [] `fmap` getProp32 wmstate win
let isFull = fromIntegral fullsc `elem` wstate
@@ -181,9 +181,9 @@ fullscreenEventHook (ClientMessageEvent _ _ _ dpy win typ (action:dats)) = do
add = 1
toggle = 2
ptype = 4 -- The atom property type for changeProperty
- chWstate f = io $ changeProperty32 dpy win state ptype propModeReplace (f wstate)
+ chWstate f = io $ changeProperty32 dpy win wmstate ptype propModeReplace (f wstate)
- when (typ == state && fi fullsc `elem` dats) $ do
+ when (typ == wmstate && fi fullsc `elem` dats) $ do
when (action == add || (action == toggle && not isFull)) $ do
chWstate (fi fullsc:)
windows $ W.float win $ W.RationalRect 0 0 1 1
diff --git a/XMonad/Layout/Fullscreen.hs b/XMonad/Layout/Fullscreen.hs
index d6dd589..1b9b0b9 100644
--- a/XMonad/Layout/Fullscreen.hs
+++ b/XMonad/Layout/Fullscreen.hs
@@ -124,11 +124,11 @@ instance LayoutModifier FullscreenFloat Window where
-- Modify the floating member of the stack set directly; this is the hackish part.
Just FullscreenChanged -> do
- state <- get
- let ws = windowset state
+ st <- get
+ let ws = windowset st
flt = W.floating ws
flt' = M.intersectionWith doFull fulls flt
- put state {windowset = ws {W.floating = M.union flt' flt}}
+ put st {windowset = ws {W.floating = M.union flt' flt}}
return $ Just $ FullscreenFloat frect $ M.filter snd fulls
where doFull (_, True) _ = frect
doFull (rect, False) _ = rect
@@ -174,9 +174,9 @@ fullscreenFloatRect r = ModifiedLayout $ FullscreenFloat r M.empty
-- | The event hook required for the layout modifiers to work
fullscreenEventHook :: Event -> X All
fullscreenEventHook (ClientMessageEvent _ _ _ dpy win typ (action:dats)) = do
- state <- getAtom "_NET_WM_STATE"
+ wmstate <- getAtom "_NET_WM_STATE"
fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN"
- wstate <- fromMaybe [] `fmap` getProp32 state win
+ wstate <- fromMaybe [] `fmap` getProp32 wmstate win
let fi :: (Integral i, Num n) => i -> n
fi = fromIntegral
isFull = fi fullsc `elem` wstate
@@ -184,8 +184,8 @@ fullscreenEventHook (ClientMessageEvent _ _ _ dpy win typ (action:dats)) = do
add = 1
toggle = 2
ptype = 4
- chWState f = io $ changeProperty32 dpy win state ptype propModeReplace (f wstate)
- when (typ == state && fi fullsc `elem` dats) $ do
+ chWState f = io $ changeProperty32 dpy win wmstate ptype propModeReplace (f wstate)
+ when (typ == wmstate && fi fullsc `elem` dats) $ do
when (action == add || (action == toggle && not isFull)) $ do
chWState (fi fullsc:)
broadcastMessage $ AddFullscreen win
diff --git a/XMonad/Layout/MouseResizableTile.hs b/XMonad/Layout/MouseResizableTile.hs
index 15286d6..1b6e558 100644
--- a/XMonad/Layout/MouseResizableTile.hs
+++ b/XMonad/Layout/MouseResizableTile.hs
@@ -136,55 +136,55 @@ mouseResizableTileMirrored :: MouseResizableTile a
mouseResizableTileMirrored = mouseResizableTile { isMirrored = True }
instance LayoutClass MouseResizableTile Window where
- doLayout state sr (W.Stack w l r) = do
- drg <- draggerGeometry $ draggerType state
+ doLayout st sr (W.Stack w l r) = do
+ drg <- draggerGeometry $ draggerType st
let wins = reverse l ++ w : r
num = length wins
sr' = mirrorAdjust sr (mirrorRect sr)
- (rects, preparedDraggers) = tile (nmaster state) (masterFrac state)
- (leftFracs state ++ repeat (slaveFrac state))
- (rightFracs state ++ repeat (slaveFrac state)) sr' num drg
+ (rects, preparedDraggers) = tile (nmaster st) (masterFrac st)
+ (leftFracs st ++ repeat (slaveFrac st))
+ (rightFracs st ++ repeat (slaveFrac st)) sr' num drg
rects' = map (mirrorAdjust id mirrorRect . sanitizeRectangle sr') rects
- mapM_ deleteDragger $ draggers state
+ mapM_ deleteDragger $ draggers st
(draggerWrs, newDraggers) <- unzip <$> mapM
- (createDragger sr . adjustForMirror (isMirrored state))
+ (createDragger sr . adjustForMirror (isMirrored st))
preparedDraggers
- return (draggerWrs ++ zip wins rects', Just $ state { draggers = newDraggers,
+ return (draggerWrs ++ zip wins rects', Just $ st { draggers = newDraggers,
focusPos = length l,
numWindows = length wins })
where
- mirrorAdjust a b = if (isMirrored state)
+ mirrorAdjust a b = if (isMirrored st)
then b
else a
- handleMessage state m
+ handleMessage st m
| Just (IncMasterN d) <- fromMessage m =
- return $ Just $ state { nmaster = max 0 (nmaster state + d) }
+ return $ Just $ st { nmaster = max 0 (nmaster st + d) }
| Just Shrink <- fromMessage m =
- return $ Just $ state { masterFrac = max 0 (masterFrac state - fracIncrement state) }
+ return $ Just $ st { masterFrac = max 0 (masterFrac st - fracIncrement st) }
| Just Expand <- fromMessage m =
- return $ Just $ state { masterFrac = min 1 (masterFrac state + fracIncrement state) }
+ return $ Just $ st { masterFrac = min 1 (masterFrac st + fracIncrement st) }
| Just ShrinkSlave <- fromMessage m =
- return $ Just $ modifySlave state (- fracIncrement state)
+ return $ Just $ modifySlave st (- fracIncrement st)
| Just ExpandSlave <- fromMessage m =
- return $ Just $ modifySlave state (fracIncrement state)
+ return $ Just $ modifySlave st (fracIncrement st)
| Just (SetMasterFraction f) <- fromMessage m =
- return $ Just $ state { masterFrac = max 0 (min 1 f) }
+ return $ Just $ st { masterFrac = max 0 (min 1 f) }
| Just (SetLeftSlaveFraction pos f) <- fromMessage m =
- return $ Just $ state { leftFracs = replaceAtPos (slaveFrac state)
- (leftFracs state) pos (max 0 (min 1 f)) }
+ return $ Just $ st { leftFracs = replaceAtPos (slaveFrac st)
+ (leftFracs st) pos (max 0 (min 1 f)) }
| Just (SetRightSlaveFraction pos f) <- fromMessage m =
- return $ Just $ state { rightFracs = replaceAtPos (slaveFrac state)
- (rightFracs state) pos (max 0 (min 1 f)) }
+ return $ Just $ st { rightFracs = replaceAtPos (slaveFrac st)
+ (rightFracs st) pos (max 0 (min 1 f)) }
- | Just e <- fromMessage m :: Maybe Event = handleResize (draggers state) (isMirrored state) e >> return Nothing
- | Just Hide <- fromMessage m = releaseResources >> return (Just $ state { draggers = [] })
- | Just ReleaseResources <- fromMessage m = releaseResources >> return (Just $ state { draggers = [] })
- where releaseResources = mapM_ deleteDragger $ draggers state
+ | Just e <- fromMessage m :: Maybe Event = handleResize (draggers st) (isMirrored st) e >> return Nothing
+ | Just Hide <- fromMessage m = releaseResources >> return (Just $ st { draggers = [] })
+ | Just ReleaseResources <- fromMessage m = releaseResources >> return (Just $ st { draggers = [] })
+ where releaseResources = mapM_ deleteDragger $ draggers st
handleMessage _ _ = return Nothing
- description state = mirror "MouseResizableTile"
- where mirror = if isMirrored state then ("Mirror " ++) else id
+ description st = mirror "MouseResizableTile"
+ where mirror = if isMirrored st then ("Mirror " ++) else id
draggerGeometry :: DraggerType -> X DraggerGeometry
draggerGeometry (FixedDragger g d) =
@@ -203,28 +203,28 @@ adjustForMirror True (draggerRect, draggerCursor, draggerInfo) =
else xC_sb_h_double_arrow
modifySlave :: MouseResizableTile a -> Rational -> MouseResizableTile a
-modifySlave state delta =
- let pos = focusPos state
- num = numWindows state
- nmaster' = nmaster state
- leftFracs' = leftFracs state
- rightFracs' = rightFracs state
- slFrac = slaveFrac state
+modifySlave st delta =
+ let pos = focusPos st
+ num = numWindows st
+ nmaster' = nmaster st
+ leftFracs' = leftFracs st
+ rightFracs' = rightFracs st
+ slFrac = slaveFrac st
draggersLeft = nmaster' - 1
draggersRight = (num - nmaster') - 1
in if pos < nmaster'
then if draggersLeft > 0
then let draggerPos = min (draggersLeft - 1) pos
oldFraction = (leftFracs' ++ repeat slFrac) !! draggerPos
- in state { leftFracs = replaceAtPos slFrac leftFracs' draggerPos
+ in st { leftFracs = replaceAtPos slFrac leftFracs' draggerPos
(max 0 (min 1 (oldFraction + delta))) }
- else state
+ else st
else if draggersRight > 0
then let draggerPos = min (draggersRight - 1) (pos - nmaster')
oldFraction = (rightFracs' ++ repeat slFrac) !! draggerPos
- in state { rightFracs = replaceAtPos slFrac rightFracs' draggerPos
+ in st { rightFracs = replaceAtPos slFrac rightFracs' draggerPos
(max 0 (min 1 (oldFraction + delta))) }
- else state
+ else st
replaceAtPos :: (Num t, Eq t) => Rational -> [Rational] -> t -> Rational -> [Rational]
replaceAtPos _ [] 0 x' = [x']
diff --git a/XMonad/Layout/WindowNavigation.hs b/XMonad/Layout/WindowNavigation.hs
index 5587b73..0244532 100644
--- a/XMonad/Layout/WindowNavigation.hs
+++ b/XMonad/Layout/WindowNavigation.hs
@@ -105,7 +105,7 @@ configurableNavigation :: LayoutClass l a => WNConfig -> l a -> ModifiedLayout W
configurableNavigation conf = ModifiedLayout (WindowNavigation conf (I Nothing))
instance LayoutModifier WindowNavigation Window where
- redoLayout (WindowNavigation conf (I state)) rscr (Just s) origwrs =
+ redoLayout (WindowNavigation conf (I st)) rscr (Just s) origwrs =
do XConf { normalBorder = nbc, focusedBorder = fbc, display = dpy } <- ask
[uc,dc,lc,rc] <-
case brightness conf of
@@ -120,8 +120,8 @@ instance LayoutModifier WindowNavigation Window where
let w = W.focus s
r = case filter ((==w).fst) origwrs of ((_,x):_) -> x
[] -> rscr
- pt = case state of Just (NS ptold _) | ptold `inrect` r -> ptold
- _ -> center r
+ pt = case st of Just (NS ptold _) | ptold `inrect` r -> ptold
+ _ -> center r
existing_wins = W.integrate s
wrs = filter ((`elem` existing_wins) . fst) $ filter ((/=r) . snd) $
filter ((/=w) . fst) origwrs
@@ -130,8 +130,8 @@ instance LayoutModifier WindowNavigation Window where
wnavigablec = nub $ concatMap
(\d -> map (\(win,_) -> (win,dirc d)) $
take 1 $ navigable d pt wrs) [U,D,R,L]
- wothers = case state of Just (NS _ wo) -> map fst wo
- _ -> []
+ wothers = case st of Just (NS _ wo) -> map fst wo
+ _ -> []
mapM_ (sc nbc) (wothers \\ map fst wnavigable)
mapM_ (\(win,c) -> sc c win) wnavigablec
return (origwrs, Just $ WindowNavigation conf $ I $ Just $ NS pt wnavigable)