Last active
June 4, 2018 19:17
-
-
Save lierdakil/216a9d2b9e934d9e1a30 to your computer and use it in GitHub Desktop.
Xmonad client for external control.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.X11.Xlib | |
import Graphics.X11.Xlib.Extras | |
import System.Environment | |
main :: IO () | |
main = sendCommand "XMONAD_COMMAND" =<< getArgs | |
sendCommand :: String -> [String] -> IO () | |
sendCommand addr (s:_) = do | |
d <- openDisplay "" | |
rw <- rootWindow d $ defaultScreen d | |
a <- internAtom d addr False | |
m <- internAtom d s False | |
allocaXEvent $ \e -> do | |
setEventType e clientMessage | |
setClientMessageEvent e rw a 32 m currentTime | |
sendEvent d rw False structureNotifyMask e | |
sync d False | |
sendCommand _ _ = return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment