mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 04:31:52 -07:00
Implement hasProperty in terms of runQuery in U.WindowProperties
This addresses issue 302 for unicode titles by actually using the complicated XMonad.ManageHook.title code, instead of reimplementing it with stringProperty (which doesn't appear to handle unicode).
This commit is contained in:
@@ -49,15 +49,7 @@ infixr 8 `Or`
|
||||
|
||||
-- | Does given window have this property?
|
||||
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 (Machine s) w = withDisplay $ \d -> fmap ((==) (Just s)) $ getStringProperty d w "WM_CLIENT_MACHINE"
|
||||
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 }
|
||||
hasProperty (Const b) _ = return b
|
||||
hasProperty p w = runQuery (propertyToQuery p) w
|
||||
|
||||
-- | Does the focused window have this property?
|
||||
focusedHasProperty :: Property -> X Bool
|
||||
|
Reference in New Issue
Block a user