mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 04:31:52 -07:00
focusedHasProperty
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user