aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorMats Jansborg <mats@jansb.org>2007-08-19 15:21:04 +0200
committerMats Jansborg <mats@jansb.org>2007-08-19 15:21:04 +0200
commit7464528c1a78f37e7451398f736c9826775e5e65 (patch)
treefe12188e0176fe99ac054290f773d1233da4c9ab /XMonad
parentbd4f72d6e453aa7dee2f8f9470f2f71af1667a92 (diff)
downloadXMonadContrib-7464528c1a78f37e7451398f736c9826775e5e65.tar.gz
XMonadContrib-7464528c1a78f37e7451398f736c9826775e5e65.tar.xz
XMonadContrib-7464528c1a78f37e7451398f736c9826775e5e65.zip
Changed getName to use locale-aware functions
Rewrote getName using getTextProperty and wcTextPropertyToTextList. darcs-hash:20070819132104-7344d-78695db057adecf12b37a3caae6ef1b624aae4f2.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Util/NamedWindows.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/XMonad/Util/NamedWindows.hs b/XMonad/Util/NamedWindows.hs
index c38e25b..719d599 100644
--- a/XMonad/Util/NamedWindows.hs
+++ b/XMonad/Util/NamedWindows.hs
@@ -22,6 +22,9 @@ module XMonad.Util.NamedWindows (
unName
) where
+import Control.Monad.Reader ( asks )
+import Control.Monad.State ( gets )
+
import qualified XMonad.StackSet as W ( peek )
@@ -40,9 +43,15 @@ instance Show NamedWindow where
show (NW n _) = n
getName :: Window -> X NamedWindow
-getName w = asks display >>= \d -> do s <- io $ getClassHint d w
- n <- maybe (resName s) id `fmap` io (fetchName d w)
- return $ NW n w
+getName w = withDisplay $ \d -> do
+ let getIt = bracket getProp (xFree . tp_value) (fmap (`NW` w) . copy)
+
+ getProp = (internAtom d "_NET_WM_NAME" False >>= getTextProperty d w)
+ `catch` \_ -> getTextProperty d w wM_NAME
+
+ copy prop = head `fmap` wcTextPropertyToTextList d prop
+
+ io $ getIt `catch` \_ -> ((`NW` w) . resName) `fmap` getClassHint d w
unName :: NamedWindow -> Window
unName (NW _ w) = w