diff options
author | tv <tv@krebsco.de> | 2023-02-07 03:44:51 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-02-07 04:25:13 +0100 |
commit | 4dce870431168ac5e4be2cb0eacce9d78c43e504 (patch) | |
tree | fbbcc71567eb62751b0225bd157ff00d9d9829b2 /lib/Graphics/X11/EWMH.hs | |
parent | e3584c77dc2ff8ac683fbbe3a849600022e46800 (diff) |
move setDesktopNames to Graphics.X11.EWMH
Diffstat (limited to 'lib/Graphics/X11/EWMH.hs')
-rw-r--r-- | lib/Graphics/X11/EWMH.hs | 12 |
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 |