summaryrefslogtreecommitdiffstats
path: root/src/Graphics/X11/Xlib/Extras/Extra.hs
blob: d88bf9d8892b4dec2e0e9a65107259509024fc0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Graphics.X11.Xlib.Extras.Extra where

import Data.Text (Text)
import Foreign.C.String.Extra (castCCharToWord8)
import qualified Data.ByteString as ByteString
import qualified Data.Text.Encoding.Extra as Text
import qualified Graphics.X11 as X11
import qualified Graphics.X11.Xlib.Extras as X11


getWindowPropertyText :: X11.Display -> X11.Atom -> X11.Window -> IO (Maybe Text)
getWindowPropertyText d a w =
  fmap (Text.decodeUtf8Lenient . ByteString.pack . map castCCharToWord8) <$>
    X11.getWindowProperty8 d a w