NamedWindows: if fetchName returns Nothing sets the name to resName ClassHint

fetchName may return a Nothing if the window's name contains multi byte
characters. In such a case the resName string of the ClassHints of that
window will be used instead.
This commit is contained in:
Andrea Rossato 2007-07-06 13:06:44 +00:00
parent 3b66626801
commit 7ce8ed2f8b

View File

@ -28,7 +28,7 @@ import Control.Monad.State ( gets )
import qualified StackSet as W ( peek )
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras ( fetchName )
import Graphics.X11.Xlib.Extras
import XMonad
@ -45,7 +45,8 @@ instance Show NamedWindow where
show (NW n _) = n
getName :: Window -> X NamedWindow
getName w = asks display >>= \d -> do n <- maybe "" id `fmap` io (fetchName d w)
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
unName :: NamedWindow -> Window