aboutsummaryrefslogtreecommitdiffstats
path: root/NamedWindows.hs
diff options
context:
space:
mode:
authorglasser <glasser@mit.edu>2007-05-23 20:42:51 +0200
committerglasser <glasser@mit.edu>2007-05-23 20:42:51 +0200
commita9504fd86b628f693a3114d882694267b029c55c (patch)
treefef4f394dab937096f2bafc6016d9a0ad04b6b5a /NamedWindows.hs
parent3c0b22f9799a4c607df473ebc77d82dd218527de (diff)
downloadXMonadContrib-a9504fd86b628f693a3114d882694267b029c55c.tar.gz
XMonadContrib-a9504fd86b628f693a3114d882694267b029c55c.tar.xz
XMonadContrib-a9504fd86b628f693a3114d882694267b029c55c.zip
Allow clients of NamedWindows to get at the name.
darcs-hash:20070523184251-64353-974a7d7d8cf92a0bb61f43b201f41d0c963fb3b3.gz
Diffstat (limited to 'NamedWindows.hs')
-rw-r--r--NamedWindows.hs5
1 files changed, 4 insertions, 1 deletions
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