[XMonad] Use workspace parameterized isToggleActive

This commit is contained in:
Ivan Malison 2017-05-19 00:50:51 -07:00
parent 1102ad4b03
commit 4df646f438
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -230,8 +230,11 @@ instance Transformer MyToggles Window where
myToggles = [LIMIT, GAPS, MAGICFOCUS]
otherToggles = [NBFULL, MIRROR]
currentWorkspace = W.workspace . W.current <$> gets windowset
isToggleActiveInCurrent t = currentWorkspace >>= isToggleActive t
followIfNoMagicFocus =
followOnlyIf $ maybe False not <$> isToggleActive MAGICFOCUS
followOnlyIf $ maybe False not <$> isToggleActiveInCurrent MAGICFOCUS
togglesMap =
fmap M.fromList $ sequence $
@ -249,14 +252,14 @@ toggleStateToString s =
toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String
toggleToStringWithState toggle =
printf "%s (%s)" (show toggle) . toggleStateToString <$>
isToggleActive toggle
isToggleActiveInCurrent toggle
selectToggle =
togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
flip whenJust sendMessage
toggleInState :: (Transformer t Window) => t -> Maybe Bool -> X Bool
toggleInState t s = fmap (/= s) (isToggleActive t)
toggleInState t s = fmap (/= s) (isToggleActiveInCurrent t)
setToggleActive' toggle active =
toggleInState toggle (Just active) >>=/