diff options
author | Devin Mullins <me@twifkak.com> | 2008-05-04 07:49:23 +0200 |
---|---|---|
committer | Devin Mullins <me@twifkak.com> | 2008-05-04 07:49:23 +0200 |
commit | 42184f0b52fdb9f802192cd1438f07c971c8b3bb (patch) | |
tree | 13ab43aba68fcfd93e947132d1fc3caba793e434 | |
parent | 7270f7ddd79cb88370043e37a034763831f9663a (diff) | |
download | XMonadContrib-42184f0b52fdb9f802192cd1438f07c971c8b3bb.tar.gz XMonadContrib-42184f0b52fdb9f802192cd1438f07c971c8b3bb.tar.xz XMonadContrib-42184f0b52fdb9f802192cd1438f07c971c8b3bb.zip |
minor cleanup on getName
darcs-hash:20080504054923-78224-e8649c630c71c3ba23f549a9e4d02aa4b2f91d31.gz
Diffstat (limited to '')
-rw-r--r-- | XMonad/Util/NamedWindows.hs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/XMonad/Util/NamedWindows.hs b/XMonad/Util/NamedWindows.hs index 4ab7078..319fed3 100644 --- a/XMonad/Util/NamedWindows.hs +++ b/XMonad/Util/NamedWindows.hs @@ -23,7 +23,9 @@ module XMonad.Util.NamedWindows ( ) where import Prelude hiding ( catch ) +import Control.Applicative ( (<$>) ) import Control.Exception ( bracket, catch ) +import Data.Maybe ( fromMaybe, listToMaybe ) import qualified XMonad.StackSet as W ( peek ) @@ -50,11 +52,7 @@ getName w = withDisplay $ \d -> do getProp = (internAtom d "_NET_WM_NAME" False >>= getTextProperty d w) `catch` \_ -> getTextProperty d w wM_NAME - copy prop = do - xs <- wcTextPropertyToTextList d prop - return $ case xs of - [] -> "" - (x:_) -> x + copy prop = fromMaybe "" . listToMaybe <$> wcTextPropertyToTextList d prop io $ getIt `catch` \_ -> ((`NW` w) . resName) `fmap` getClassHint d w |