Actions.GroupNavigation: add isOnAnyVisibleWS

This commit is contained in:
Alex Hirzel 2019-02-27 22:59:07 -05:00
parent cce7f50372
commit 51bc32ea75

View File

@ -27,6 +27,7 @@ module XMonad.Actions.GroupNavigation ( -- * Usage
, nextMatchOrDo
, nextMatchWithThis
, historyHook
, isOnAnyVisibleWS
) where
import Control.Monad.Reader
@ -216,3 +217,14 @@ findM cond xs = findM' cond (viewl xs)
if isMatch
then return (Just x')
else findM qry xs'
isOnAnyVisibleWS :: Query Bool
isOnAnyVisibleWS = do
w <- ask
ws <- liftX $ gets windowset
let allVisible = concat $ maybe [] W.integrate . W.stack . W.workspace <$> W.current ws:W.visible ws
visibleWs = w `elem` allVisible
unfocused = maybe True (w /=) $ W.peek ws
return $ visibleWs && unfocused