----------------------------------------------------------------------------- -- | -- Module : Main -- Copyright : (c) Andrea Rossato -- License : GPL2 -- -- Maintainer : Andrea Rossato -- Stability : unstable -- Portability : unportable -- -- Toggle override_redirect for an X window -- ----------------------------------------------------------------------------- module Main where import Graphics.X11.Xlib import Graphics.X11.Xlib.Extras import System.Environment import Control.Monad usage :: String -> String usage n = "Usage: " ++ n ++ " command" main :: IO () main = do args <- getArgs pn <- getProgName let com = case args of [] -> error $ usage pn w -> (w !! 0) dpy <- openDisplay "" rootw <- rootWindow dpy $ defaultScreen dpy setTextProperty dpy rootw com wM_COMMAND allocaXEvent $ \e -> do setEventType e propertyNotify sendEvent dpy rootw False propertyChangeMask e sync dpy False