focusedHasProperty

This commit is contained in:
redbeard0531
2008-03-25 04:04:12 +00:00
parent 0900dbf0be
commit 492b1e27c2

View File

@@ -14,9 +14,10 @@
module XMonad.Util.WindowProperties (
-- * Usage
-- $usage
Property(..), hasProperty)
Property(..), hasProperty, focusedHasProperty)
where
import XMonad
import qualified XMonad.StackSet as W
-- $usage
-- This module allows to specify window properties, such as title, classname or
@@ -47,3 +48,12 @@ hasProperty (Or p1 p2) w = do { r1 <- hasProperty p1 w; r2 <- hasProperty p2
hasProperty (Not p1) w = do { r1 <- hasProperty p1 w; return $ not r1 }
hasProperty (Const b) _ = return b
-- | Does the focused window have this property?
focusedHasProperty :: Property -> X Bool
focusedHasProperty p = do
ws <- gets windowset
let ms = W.stack $ W.workspace $ W.current ws
case ms of
Just s -> hasProperty p $ W.focus s
Nothing -> return False