forked from colonelpanic/dotfiles
[XMonad] Rewrite getClass using the applicative style
This commit is contained in:
parent
57b6f72b84
commit
31d039b0b2
@ -216,17 +216,14 @@ myWindowBringerConfig =
|
|||||||
, windowTitler = myDecorateName
|
, windowTitler = myDecorateName
|
||||||
}
|
}
|
||||||
|
|
||||||
classIfMatches window entry = do
|
classIfMatches window entry =
|
||||||
result <- runQuery (fst entry) window
|
ifL (Just $ snd entry) Nothing <$> runQuery (fst entry) window
|
||||||
return $ if result then Just $ snd entry else Nothing
|
|
||||||
|
|
||||||
getClass w = do
|
getClassRaw w = fmap resClass $ withDisplay $ io . flip getClassHint w
|
||||||
virtualClass <- findM (classIfMatches w) virtualClasses
|
|
||||||
case virtualClass of
|
getVirtualClass = flip findM virtualClasses . classIfMatches
|
||||||
Nothing -> do
|
|
||||||
classHint <- withDisplay $ \d -> io $ getClassHint d w
|
getClass w = fromMaybe <$> getClassRaw w <*> getVirtualClass w
|
||||||
return $ resClass classHint
|
|
||||||
Just name -> return name
|
|
||||||
|
|
||||||
myDecorateName ws w = do
|
myDecorateName ws w = do
|
||||||
name <- show <$> getName w
|
name <- show <$> getName w
|
||||||
|
Loading…
Reference in New Issue
Block a user