Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/runhaskell
- import Graphics.X11.Xlib
- import Graphics.X11.Xlib.Extras
- import System.Environment
- usage :: String -> String
- usage n = "Usage: " ++ n ++ " command number\nSend a command number to a running instance of XMonad"
- main :: IO ()
- main = do
- args <- getArgs
- pn <- getProgName
- let com = case args of
- [] -> error $ usage pn
- w -> head w
- sendCommand com
- sendCommand :: String -> IO ()
- sendCommand s = do
- d <- openDisplay ""
- rw <- rootWindow d $ defaultScreen d
- a <- internAtom d "XMONAD_COMMAND" False
- allocaXEvent $ \e -> do
- setEventType e clientMessage
- setClientMessageEvent e rw a 32 (fromIntegral (read s :: Int)) currentTime
- sendEvent d rw False structureNotifyMask e
- sync d False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement