From a9504fd86b628f693a3114d882694267b029c55c Mon Sep 17 00:00:00 2001 From: glasser Date: Wed, 23 May 2007 20:42:51 +0200 Subject: Allow clients of NamedWindows to get at the name. darcs-hash:20070523184251-64353-974a7d7d8cf92a0bb61f43b201f41d0c963fb3b3.gz --- NamedWindows.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'NamedWindows.hs') diff --git a/NamedWindows.hs b/NamedWindows.hs index 71f8fe9..307c407 100644 --- a/NamedWindows.hs +++ b/NamedWindows.hs @@ -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 -- cgit v1.2.3