aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Util/WindowProperties.hs
diff options
context:
space:
mode:
authorRoman Cheplyaka <roma@ro-che.info>2008-04-09 19:49:35 +0200
committerRoman Cheplyaka <roma@ro-che.info>2008-04-09 19:49:35 +0200
commitb0719aed6d5f522e738f6d11220596cd139f4599 (patch)
tree8d1be532c7114ec2fb96311485208ed26086b737 /XMonad/Util/WindowProperties.hs
parent5de283ea52fe312627ad01485d8267206095e11a (diff)
downloadXMonadContrib-b0719aed6d5f522e738f6d11220596cd139f4599.tar.gz
XMonadContrib-b0719aed6d5f522e738f6d11220596cd139f4599.tar.xz
XMonadContrib-b0719aed6d5f522e738f6d11220596cd139f4599.zip
XMonad.Util.WindowProperties: add WM_WINDOW_ROLE as Role
darcs-hash:20080409174935-3ebed-fdde76e2a0889e75467fe94af6f34f875a738dac.gz
Diffstat (limited to 'XMonad/Util/WindowProperties.hs')
-rw-r--r--XMonad/Util/WindowProperties.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/XMonad/Util/WindowProperties.hs b/XMonad/Util/WindowProperties.hs
index b1d0055..87715a6 100644
--- a/XMonad/Util/WindowProperties.hs
+++ b/XMonad/Util/WindowProperties.hs
@@ -26,10 +26,11 @@ import qualified XMonad.StackSet as W
-- In contrast to ManageHook properties, these are instances of Show and Read,
-- so they can be used in layout definitions etc. For example usage see "XMonad.Layout.IM"
--- | Property constructors are quite self-explaining.
+-- | Most of the property constructors are quite self-explaining.
data Property = Title String
| ClassName String
| Resource String
+ | Role String -- ^ WM_WINDOW_ROLE property
| And Property Property
| Or Property Property
| Not Property
@@ -43,6 +44,7 @@ hasProperty :: Property -> Window -> X Bool
hasProperty (Title s) w = withDisplay $ \d -> fmap (Just s ==) $ io $ fetchName d w
hasProperty (Resource s) w = withDisplay $ \d -> fmap ((==) s . resName ) $ io $ getClassHint d w
hasProperty (ClassName s) w = withDisplay $ \d -> fmap ((==) s . resClass) $ io $ getClassHint d w
+hasProperty (Role s) w = withDisplay $ \d -> fmap ((==) (Just s)) $ getStringProperty d w "WM_WINDOW_ROLE"
hasProperty (And p1 p2) w = do { r1 <- hasProperty p1 w; r2 <- hasProperty p2 w; return $ r1 && r2 }
hasProperty (Or p1 p2) w = do { r1 <- hasProperty p1 w; r2 <- hasProperty p2 w; return $ r1 || r2 }
hasProperty (Not p1) w = do { r1 <- hasProperty p1 w; return $ not r1 }