diff options
Diffstat (limited to 'lib/Graphics/X11/EWMH.hs')
-rw-r--r-- | lib/Graphics/X11/EWMH.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Graphics/X11/EWMH.hs b/lib/Graphics/X11/EWMH.hs index a44f5f7..856cfdb 100644 --- a/lib/Graphics/X11/EWMH.hs +++ b/lib/Graphics/X11/EWMH.hs @@ -8,10 +8,11 @@ import Control.Applicative ((<|>)) import Data.List.Extra (split) import Foreign.C.Types (CLong) import Graphics.X11.EWMH.Atom -import Graphics.X11.Types (Window) +import Graphics.X11.Types (Window, clientMessage, substructureNotifyMask) import Graphics.X11.Xlib.Atom.Extra +import Graphics.X11.Xlib.Event (allocaXEvent, sendEvent) import Graphics.X11.Xlib.Display (defaultRootWindow) -import Graphics.X11.Xlib.Extras (changeProperty8, getWindowProperty32, propModeReplace) +import Graphics.X11.Xlib.Extras (changeProperty8, getWindowProperty32, propModeReplace, setClientMessageEvent', setEventType) import Graphics.X11.Xlib.Extras.Extra (getWindowPropertyString) import Graphics.X11.Xlib.Types (Display) @@ -55,3 +56,13 @@ setDesktopNames names dpy = do a = _NET_DESKTOP_NAMES t = uTF8_STRING r = defaultRootWindow dpy + +switchToDesktop :: Display -> CLong -> IO () +switchToDesktop dpy s = + allocaXEvent $ \e -> do + setEventType e clientMessage + setClientMessageEvent' e w _NET_CURRENT_DESKTOP 32 [fromIntegral s,0,0,0,0] + sendEvent dpy w False mask e + where + w = defaultRootWindow dpy + mask = substructureNotifyMask |