[XMonad] Fix indentation and whitespace in several spots

This commit is contained in:
Ivan Malison 2016-11-29 15:47:24 -08:00
parent f640202a26
commit 18cfb40606
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -124,10 +124,11 @@ emacsSelector = className =? "Emacs"
transmissionSelector = fmap (isPrefixOf "Transmission") title transmissionSelector = fmap (isPrefixOf "Transmission") title
hangoutsSelector = chromeSelectorBase <&&> fmap isHangoutsTitle title hangoutsSelector = chromeSelectorBase <&&> fmap isHangoutsTitle title
virtualClasses = [ (hangoutsSelector, "Hangouts") virtualClasses =
, (chromeSelector, "Chrome") [ (hangoutsSelector, "Hangouts")
, (transmissionSelector, "Transmission") , (chromeSelector, "Chrome")
] , (transmissionSelector, "Transmission")
]
-- Commands -- Commands
@ -158,10 +159,11 @@ unmodifyLayout (ModifiedLayout _ x') = x'
selectLimit = selectLimit =
DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"] >>= (setLimit . read) DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"] >>= (setLimit . read)
data MyToggles = LIMIT data MyToggles
| GAPS = LIMIT
| MAGICFOCUS | GAPS
deriving (Read, Show, Eq, Typeable) | MAGICFOCUS
deriving (Read, Show, Eq, Typeable)
instance Transformer MyToggles Window where instance Transformer MyToggles Window where
transform LIMIT x k = k (limitSlice 2 x) unmodifyLayout transform LIMIT x k = k (limitSlice 2 x) unmodifyLayout
@ -176,7 +178,7 @@ followIfNoMagicFocus =
togglesMap = togglesMap =
fmap M.fromList $ sequence $ fmap M.fromList $ sequence $
map toggleTuple myToggles ++ map toggleTuple otherToggles map toggleTuple myToggles ++ map toggleTuple otherToggles
where where
toggleTuple toggle = toggleTuple toggle =
fmap (\str -> (str, Toggle toggle)) (toggleToStringWithState toggle) fmap (\str -> (str, Toggle toggle)) (toggleToStringWithState toggle)
@ -190,7 +192,8 @@ toggleStateToString s =
toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String
toggleToStringWithState toggle = toggleToStringWithState toggle =
(printf "%s (%s)" (show toggle) . toggleStateToString) <$> isToggleActive toggle (printf "%s (%s)" (show toggle) . toggleStateToString) <$>
isToggleActive toggle
selectToggle = selectToggle =
togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>= togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
@ -277,7 +280,8 @@ myDecorateName ws w = do
-- done with the existing window bringer interface -- done with the existing window bringer interface
myBringWindow WindowBringerConfig { menuCommand = cmd myBringWindow WindowBringerConfig { menuCommand = cmd
, menuArgs = args , menuArgs = args
, windowTitler = titler } = , windowTitler = titler
} =
windowMap' titler >>= DM.menuMapArgs cmd args >>= flip whenJust action windowMap' titler >>= DM.menuMapArgs cmd args >>= flip whenJust action
where where
action window = action window =
@ -358,9 +362,9 @@ getCurrentWS = W.stack . W.workspace . W.current
withWorkspace f = withWindowSet $ \ws -> maybe (return ()) f (getCurrentWS ws) withWorkspace f = withWindowSet $ \ws -> maybe (return ()) f (getCurrentWS ws)
minimizeOtherClassesInWorkspace = minimizeOtherClassesInWorkspace =
actOnWindowsInWorkspace minimizeWindow windowsWithUnfocusedClass actOnWindowsInWorkspace minimizeWindow windowsWithUnfocusedClass
maximizeSameClassesInWorkspace = maximizeSameClassesInWorkspace =
actOnWindowsInWorkspace maybeUnminimize windowsWithFocusedClass actOnWindowsInWorkspace maybeUnminimize windowsWithFocusedClass
-- Type annotation is needed to resolve ambiguity -- Type annotation is needed to resolve ambiguity
actOnWindowsInWorkspace :: (Window -> X ()) actOnWindowsInWorkspace :: (Window -> X ())
@ -371,17 +375,17 @@ actOnWindowsInWorkspace windowAction getWindowsAction = restoreFocus $
windowsWithUnfocusedClass ws = windowsWithOtherClasses (W.focus ws) ws windowsWithUnfocusedClass ws = windowsWithOtherClasses (W.focus ws) ws
windowsWithFocusedClass ws = windowsWithSameClass (W.focus ws) ws windowsWithFocusedClass ws = windowsWithSameClass (W.focus ws) ws
windowsWithOtherClasses = windowsMatchingPredicate (/=) windowsWithOtherClasses = windowsMatchingClassPredicate (/=)
windowsWithSameClass = windowsMatchingPredicate (==) windowsWithSameClass = windowsMatchingClassPredicate (==)
windowsMatchingPredicate predicate window workspace = windowsMatchingClassPredicate predicate window workspace =
windowsSatisfyingPredicate workspace $ do windowsSatisfyingPredicate workspace $ do
windowClass <- getClass window windowClass <- getClass window
return $ predicate windowClass return $ predicate windowClass
windowsSatisfyingPredicate workspace getPredicate = do windowsSatisfyingPredicate workspace getPredicate = do
predicate <- getPredicate predicate <- getPredicate
filterM (\w -> predicate <$> getClass w) (W.integrate workspace) filterM (\w -> predicate <$> getClass w) (W.integrate workspace)
windowIsMinimized w = do windowIsMinimized w = do
minimized <- XS.gets minimizedStack minimized <- XS.gets minimizedStack
@ -476,20 +480,20 @@ swapFocusedWith w ws = W.modify' (swapFocusedWith' w) (W.delete' w ws)
swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current]) swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current])
swapMinimizeStateAfter action = swapMinimizeStateAfter action =
withFocused $ withFocused $ \originalWindow -> do
\originalWindow -> do
_ <- action _ <- action
restoreFocus $ restoreFocus $ do
do maybeUnminimizeFocused maybeUnminimizeFocused
withFocused $ withFocused $ \newWindow ->
\newWindow -> when (newWindow /= originalWindow) $ minimizeWindow originalWindow when (newWindow /= originalWindow) $ minimizeWindow originalWindow
-- Named Scratchpads -- Named Scratchpads
scratchpads = [ NS "htop" htopCommnad (title =? "htop") nonFloating scratchpads =
, NS "spotify" spotifyCommand spotifySelector nonFloating [ NS "htop" htopCommnad (title =? "htop") nonFloating
, NS "hangouts" hangoutsCommand hangoutsSelector nonFloating , NS "spotify" spotifyCommand spotifySelector nonFloating
] , NS "hangouts" hangoutsCommand hangoutsSelector nonFloating
]
doScratchpad = deactivateFullAnd . namedScratchpadAction scratchpads doScratchpad = deactivateFullAnd . namedScratchpadAction scratchpads