diff --git a/CHANGES.md b/CHANGES.md index 7ef2852..12b741d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -51,6 +51,9 @@ * Added `withUnfocused` function to `XMonad.Operations`, allowing for `X` operations to be applied to unfocused windows. + * Added `willFloat` function to `XMonad.ManageHooks` to detect whether the + (about to be) managed window will be a floating window or not + [these build scripts]: https://github.com/xmonad/xmonad-testing/tree/master/build-scripts ### Bug Fixes diff --git a/src/XMonad/ManageHook.hs b/src/XMonad/ManageHook.hs index 1a21f2a..29c9f40 100644 --- a/src/XMonad/ManageHook.hs +++ b/src/XMonad/ManageHook.hs @@ -106,6 +106,14 @@ getStringProperty d w p = do md <- io $ getWindowProperty8 d a w return $ fmap (map (toEnum . fromIntegral)) md +-- | Return whether the window will be a floating window or not +willFloat :: Query Bool +willFloat = ask >>= \w -> liftX $ withDisplay $ \d -> do + sh <- io $ getWMNormalHints d w + let isFixedSize = isJust (sh_min_size sh) && sh_min_size sh == sh_max_size sh + isTransient <- isJust <$> io (getTransientForHint d w) + return (isFixedSize || isTransient) + -- | Modify the 'WindowSet' with a pure function. doF :: (s -> s) -> Query (Endo s) doF = return . Endo