mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -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 :: String -> Window -> X String
|
||||||
getEWMHTitle sub w = do
|
getEWMHTitle sub w = do
|
||||||
a <- getAtom $ "_NET_WM_" ++ (if null sub then "" else '_':sub) ++ "_NAME"
|
a <- getAtom $ "_NET_WM_" ++ (if null sub then "" else '_':sub) ++ "_NAME"
|
||||||
(Just t) <- withDisplay $ \d -> io $ getWindowProperty32 d a w
|
getDecodedStringProp w a -- should always be UTF8_STRING but rules are made to be broken
|
||||||
return $ map (toEnum . fromEnum) t
|
|
||||||
|
|
||||||
getICCCMTitle :: Window -> X String
|
getICCCMTitle :: Window -> X String
|
||||||
getICCCMTitle w = getDecodedStringProp w wM_NAME
|
getICCCMTitle w = getDecodedStringProp w wM_NAME
|
||||||
@ -116,7 +115,7 @@ getICCCMTitle w = getDecodedStringProp w wM_NAME
|
|||||||
getDecodedStringProp :: Window -> Atom -> X String
|
getDecodedStringProp :: Window -> Atom -> X String
|
||||||
getDecodedStringProp w a = do
|
getDecodedStringProp w a = do
|
||||||
t@(TextProperty t' _ 8 _) <- withDisplay $ \d -> io $ getTextProperty d w a
|
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) $
|
catchX' (tryCompound t) $
|
||||||
io ((:[]) <$> peekCString t')
|
io ((:[]) <$> peekCString t')
|
||||||
return s
|
return s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user