summaryrefslogtreecommitdiffstats
path: root/lib/Graphics/X11/EWMH.hs
diff options
context:
space:
mode:
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