module Graphics.X11.Xlib.Display.Extra where import Control.Exception (bracket) import System.Environment (getEnv) import System.IO.Unsafe (unsafePerformIO) import Graphics.X11.Xlib.Types (Display) import Graphics.X11.Xlib.Display (closeDisplay, openDisplay) defaultDisplayName :: String defaultDisplayName = unsafePerformIO (getEnv "DISPLAY") withDisplay :: String -> (Display -> IO a) -> IO a withDisplay display = bracket (openDisplay display) closeDisplay withDefaultDisplay :: (Display -> IO a) -> IO a withDefaultDisplay = withDisplay defaultDisplayName