Advertisement
Guest User

Untitled

a guest
Jul 25th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. focusByClass :: String -> X()
  2. focusByClass n = do
  3.   ws <- gets $ W.index . windowset
  4.   app <- findByQuery ws (className =? n)
  5.   whenJust app focus
  6.  
  7. findByQuery :: [Window] -> Query Bool -> X (Maybe Window)
  8. findByQuery ws q = do
  9.   w <- filterM (runQuery q) ws
  10.   case (length w > 0) of
  11.     True -> return $ Just $ head w
  12.     False -> return Nothing    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement