forked from colonelpanic/dotfiles
[XMonad] Clean up ToggleFade
This commit is contained in:
parent
1065ee6937
commit
a75fa5f584
@ -288,28 +288,27 @@ getWorkspaceNameFromTag getWSName tag =
|
||||
|
||||
-- Toggleable fade
|
||||
|
||||
newtype ToggleFade = ToggleFade (M.Map Window Bool)
|
||||
newtype ToggleFade =
|
||||
ToggleFade {
|
||||
fadesMap :: (M.Map Window Bool)
|
||||
}
|
||||
deriving (Typeable, Read, Show)
|
||||
|
||||
instance ExtensionClass ToggleFade where
|
||||
initialValue = ToggleFade M.empty
|
||||
extensionType = PersistentExtension
|
||||
|
||||
fadeEnabledForWindow = ask >>= \w -> liftX (do
|
||||
ToggleFade toggleMap <- XS.get
|
||||
return $ M.findWithDefault True w toggleMap)
|
||||
fadeEnabledForWindow = ask >>= \w ->
|
||||
liftX $ (M.findWithDefault True w) . fadesMap <$> XS.get
|
||||
|
||||
toggleFadeInactiveLogHook = fadeOutLogHook . fadeIf (isUnfocused <&&> fadeEnabledForWindow)
|
||||
toggleFadeInactiveLogHook =
|
||||
fadeOutLogHook . fadeIf (isUnfocused <&&> fadeEnabledForWindow)
|
||||
|
||||
toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
|
||||
ToggleFade toggleMap <- XS.get
|
||||
let maybeWindow = W.peek windowSet
|
||||
case maybeWindow of
|
||||
Nothing -> return ()
|
||||
Just window -> do
|
||||
let existingValue = M.findWithDefault True window toggleMap
|
||||
XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap)
|
||||
return ()
|
||||
toggleFadingForActiveWindow = withWindowSet $
|
||||
maybe (return()) toggleFadingForWindow . W.peek
|
||||
|
||||
toggleFadingForWindow w =
|
||||
fmap (ToggleFade . toggleInMap w . fadesMap) XS.get >>= XS.put
|
||||
|
||||
-- Minimize not in class
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user