summaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/ManageHook.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/XMonad/ManageHook.hs b/XMonad/ManageHook.hs
index 072fe1f..b4996b2 100644
--- a/XMonad/ManageHook.hs
+++ b/XMonad/ManageHook.hs
@@ -20,6 +20,7 @@ module XMonad.ManageHook where
import XMonad.Core
import Graphics.X11.Xlib.Extras
+import Graphics.X11.Xlib (Display,Window)
import Control.Monad.Reader
import Data.Maybe
import Data.Monoid
@@ -65,6 +66,17 @@ title = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap (fromMaybe "") $ io
resource = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resName $ io $ getClassHint d w)
className = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resClass $ io $ getClassHint d w)
+-- | A query that can return an arbitrary X property of type String,
+-- identified by name.
+property :: String -> Query String
+property p = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap (fromMaybe "") $ getProperty d w p)
+
+getProperty :: Display -> Window -> String -> X (Maybe String)
+getProperty d w p = do
+ a <- getAtom p
+ md <- io $ getWindowProperty8 d a w
+ return $ fmap (map (toEnum . fromIntegral)) md
+
-- | Modify the 'WindowSet' with a pure function.
doF :: (WindowSet -> WindowSet) -> ManageHook
doF = return . Endo