From 7ce8ed2f8bf8b9a189abfa21309f839ca23cf41f Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 6 Jul 2007 13:06:44 +0000 Subject: [PATCH] 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. --- NamedWindows.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NamedWindows.hs b/NamedWindows.hs index d807a0c3..790fe1a6 100644 --- a/NamedWindows.hs +++ b/NamedWindows.hs @@ -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