Having the following Haskell code:
import Control.Concurrent
import Data.Time.Clock
import Debug.Trace
import Graphics.X11
import Graphics.X11.Xlib.Extras
main :: IO ()
main = do
d <- openDisplay ""
loop d
loop :: Display -> IO ()
loop d = do
time <- getCurrentTime
(w, _) <- getInputFocus d
maybeName <- fetchName d w
windowAttrs <- getWindowAttributes d w
print $ show time ++ " Name: " ++ show maybeName ++ " Width: " ++ show (wa_width windowAttrs)
threadDelay 1000000
loop d
The window title returned by fetchName is always Nothing
.
Haskell X11 library is a wrapper around Xlib
Possibly related issues:
- The width of the window is either correct or it has the value
1
. - XFetchName always returns 0