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
|
-- Toggleable fade
|
||||||
|
|
||||||
newtype ToggleFade = ToggleFade (M.Map Window Bool)
|
newtype ToggleFade =
|
||||||
|
ToggleFade {
|
||||||
|
fadesMap :: (M.Map Window Bool)
|
||||||
|
}
|
||||||
deriving (Typeable, Read, Show)
|
deriving (Typeable, Read, Show)
|
||||||
|
|
||||||
instance ExtensionClass ToggleFade where
|
instance ExtensionClass ToggleFade where
|
||||||
initialValue = ToggleFade M.empty
|
initialValue = ToggleFade M.empty
|
||||||
extensionType = PersistentExtension
|
extensionType = PersistentExtension
|
||||||
|
|
||||||
fadeEnabledForWindow = ask >>= \w -> liftX (do
|
fadeEnabledForWindow = ask >>= \w ->
|
||||||
ToggleFade toggleMap <- XS.get
|
liftX $ (M.findWithDefault True w) . fadesMap <$> XS.get
|
||||||
return $ M.findWithDefault True w toggleMap)
|
|
||||||
|
|
||||||
toggleFadeInactiveLogHook = fadeOutLogHook . fadeIf (isUnfocused <&&> fadeEnabledForWindow)
|
toggleFadeInactiveLogHook =
|
||||||
|
fadeOutLogHook . fadeIf (isUnfocused <&&> fadeEnabledForWindow)
|
||||||
|
|
||||||
toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
|
toggleFadingForActiveWindow = withWindowSet $
|
||||||
ToggleFade toggleMap <- XS.get
|
maybe (return()) toggleFadingForWindow . W.peek
|
||||||
let maybeWindow = W.peek windowSet
|
|
||||||
case maybeWindow of
|
toggleFadingForWindow w =
|
||||||
Nothing -> return ()
|
fmap (ToggleFade . toggleInMap w . fadesMap) XS.get >>= XS.put
|
||||||
Just window -> do
|
|
||||||
let existingValue = M.findWithDefault True window toggleMap
|
|
||||||
XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap)
|
|
||||||
return ()
|
|
||||||
|
|
||||||
-- Minimize not in class
|
-- Minimize not in class
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user