summaryrefslogtreecommitdiffstats
path: root/lib/Graphics/X11/EWMH.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-02-07 03:44:51 +0100
committertv <tv@krebsco.de>2023-02-07 04:25:13 +0100
commit4dce870431168ac5e4be2cb0eacce9d78c43e504 (patch)
treefbbcc71567eb62751b0225bd157ff00d9d9829b2 /lib/Graphics/X11/EWMH.hs
parente3584c77dc2ff8ac683fbbe3a849600022e46800 (diff)
move setDesktopNames to Graphics.X11.EWMH
Diffstat (limited to 'lib/Graphics/X11/EWMH.hs')
-rw-r--r--lib/Graphics/X11/EWMH.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Graphics/X11/EWMH.hs b/lib/Graphics/X11/EWMH.hs
index 210d1bf..a44f5f7 100644
--- a/lib/Graphics/X11/EWMH.hs
+++ b/lib/Graphics/X11/EWMH.hs
@@ -3,6 +3,7 @@ module Graphics.X11.EWMH
, module Graphics.X11.EWMH.Atom
) where
+import Codec.Binary.UTF8.String (encode)
import Control.Applicative ((<|>))
import Data.List.Extra (split)
import Foreign.C.Types (CLong)
@@ -10,7 +11,7 @@ import Graphics.X11.EWMH.Atom
import Graphics.X11.Types (Window)
import Graphics.X11.Xlib.Atom.Extra
import Graphics.X11.Xlib.Display (defaultRootWindow)
-import Graphics.X11.Xlib.Extras (getWindowProperty32)
+import Graphics.X11.Xlib.Extras (changeProperty8, getWindowProperty32, propModeReplace)
import Graphics.X11.Xlib.Extras.Extra (getWindowPropertyString)
import Graphics.X11.Xlib.Types (Display)
@@ -45,3 +46,12 @@ getWindowTitle :: Display -> Window -> IO (Maybe String)
getWindowTitle dpy w =
getWindowPropertyString dpy _NET_WM_NAME w <|>
getWindowPropertyString dpy _WM_NAME w
+
+setDesktopNames :: [String] -> Display -> IO ()
+setDesktopNames names dpy = do
+ changeProperty8 dpy r a t propModeReplace names'
+ where
+ names' = map fromIntegral $ concatMap ((<>[0]) . encode) names
+ a = _NET_DESKTOP_NAMES
+ t = uTF8_STRING
+ r = defaultRootWindow dpy