如何使用 Xmonad 绘制任意 window?

How to paint a arbitrary window with Xmonad?

{-# OPTIONS -Wno-unused-imports #-}
{-# OPTIONS -Wno-type-defaults #-}
module MyDraw where

import XMonad.Util.XUtils
import XMonad
import XMonad.Config.Prime
import XMonad.Util.Font

doStuff :: X ()
doStuff = do
  let myRec = Rectangle 100 100 300 300
  w <- createNewWindow  myRec Nothing "blue" True
  fs <- initXMF "xft:Droid Sans Mono for Powerline.otf: Droid Sans Mono for Powerline:style=Regular:size=32"
  paintAndWrite w fs (fromIntegral 120) (fromIntegral 120) (fromIntegral 10)
    "green" "blue" "black"  "white" [AlignCenter, AlignCenter] ["Testing", "123"]

我正在尝试使用 Xmonad 绘制任意 window,我正在使用上面的代码,尽管它似乎没有做任何事情?我该如何进一步调试?

我正在使用键绑定调用上面的代码。我相当确定它是 运行,因为我在它之后成功地打印了一些代码 运行。也就是说:

            doStuff
            liftIO $ logToTmpFile "done"

我需要 showWindow w:

doStuff :: X ()
doStuff = do
  let myRec = Rectangle 100 100 300 300
  w <- createNewWindow  myRec Nothing "blue" True
  showWindow w
  fs <- initXMF "xft:Droid Sans Mono for Powerline.otf: Droid Sans Mono for Powerline:style=Regular:size=32"
  paintAndWrite w fs (fromIntegral 120) (fromIntegral 120) (fromIntegral 10)
    "green" "blue" "black"  "white" [AlignCenter, AlignCenter] ["Testing", "123"]