summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Graphics/X11/EWMH.hs12
-rw-r--r--lib/Graphics/X11/Xlib/Atom/Extra.hs3
2 files changed, 14 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
diff --git a/lib/Graphics/X11/Xlib/Atom/Extra.hs b/lib/Graphics/X11/Xlib/Atom/Extra.hs
index d96b54f..444519e 100644
--- a/lib/Graphics/X11/Xlib/Atom/Extra.hs
+++ b/lib/Graphics/X11/Xlib/Atom/Extra.hs
@@ -19,3 +19,6 @@ _WIN_WORKSPACE_NAMES = unsafeInternAtom "_WIN_WORKSPACE_NAMES" True
_WM_NAME :: Atom
_WM_NAME = unsafeInternAtom "WM_NAME" True
+
+uTF8_STRING :: Atom
+uTF8_STRING = unsafeInternAtom "UTF8_STRING" True