mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
fix EWMH titles
I have no idea what I was thinking when I wrote that code. While at it, just reused the code for ICCCM title which already assumes the client may have broken the rules (I think we have seen a case of `WM_NAME` being `UTF8_STRING`).
This commit is contained in:
parent
04c0ddd3e0
commit
4998e946cc
@ -107,8 +107,7 @@ debugWindow w = do
|
||||
getEWMHTitle :: String -> Window -> X String
|
||||
getEWMHTitle sub w = do
|
||||
a <- getAtom $ "_NET_WM_" ++ (if null sub then "" else '_':sub) ++ "_NAME"
|
||||
(Just t) <- withDisplay $ \d -> io $ getWindowProperty32 d a w
|
||||
return $ map (toEnum . fromEnum) t
|
||||
getDecodedStringProp w a -- should always be UTF8_STRING but rules are made to be broken
|
||||
|
||||
getICCCMTitle :: Window -> X String
|
||||
getICCCMTitle w = getDecodedStringProp w wM_NAME
|
||||
@ -116,7 +115,7 @@ getICCCMTitle w = getDecodedStringProp w wM_NAME
|
||||
getDecodedStringProp :: Window -> Atom -> X String
|
||||
getDecodedStringProp w a = do
|
||||
t@(TextProperty t' _ 8 _) <- withDisplay $ \d -> io $ getTextProperty d w a
|
||||
[s] <- catchX' (tryUTF8 t) $
|
||||
[s] <- catchX' (tryUTF8 t) $ -- shouldn't happen but some apps do it
|
||||
catchX' (tryCompound t) $
|
||||
io ((:[]) <$> peekCString t')
|
||||
return s
|
||||
|
Loading…
x
Reference in New Issue
Block a user