Allow clients of NamedWindows to get at the name.

This commit is contained in:
glasser 2007-05-23 18:42:51 +00:00
parent a1b8a3ba79
commit 1d886ae670

View File

@ -1,4 +1,4 @@
module XMonadContrib.NamedWindows ( NamedWindow, getName, withNamedWindow, unName ) where
module XMonadContrib.NamedWindows ( NamedWindow, getName, withNamedWindow, unName, name ) where
-- This module allows you to associate the X titles of windows with
-- them. See XMonadContrib.Mosaic for an example of its use.
@ -26,6 +26,9 @@ getName w = asks display >>= \d -> do n <- maybe "" id `fmap` io (fetchName d w)
unName :: NamedWindow -> Window
unName (NW _ w) = w
name :: NamedWindow -> String
name (NW n _) = n
withNamedWindow :: (NamedWindow -> X ()) -> X ()
withNamedWindow f = do ws <- gets windowset
whenJust (W.peek ws) $ \w -> getName w >>= f