diff options
author | tv <tv@krebsco.de> | 2023-02-07 04:10:06 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-02-07 04:25:25 +0100 |
commit | 9f8d54bce82fb61c428996a9367ec1579410ff32 (patch) | |
tree | 6dce6b6a77fd7c242d7be908550ab59da3f7388c /lib/Graphics/X11/EWMH.hs | |
parent | 63ee5288aea5972d2eb0021a797fc6ec770d6ee0 (diff) |
move switchToDesktop to Graphics.X11.EWMH
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 |