ManageHelpers: add isDialog

This commit is contained in:
johanngiwer
2009-01-08 23:25:05 +00:00
parent f885e942e9
commit 021298cb34

View File

@@ -30,6 +30,7 @@ module XMonad.Hooks.ManageHelpers (
(-?>), (/=?), (<==?), (</=?), (-->>), (-?>>),
isKDETrayWindow,
isFullscreen,
isDialog,
transientTo,
maybeToDefinite,
MaybeManageHook,
@@ -132,6 +133,17 @@ isFullscreen = ask >>= \w -> liftX $ do
Just xs -> fromIntegral full `elem` xs
_ -> False
-- | A predicate to check whether a window is a dialog.
isDialog :: Query Bool
isDialog = ask >>= \w -> liftX $ do
dpy <- asks display
w_type <- getAtom "_NET_WM_WINDOW_TYPE"
w_dialog <- getAtom "_NET_WM_WINDOW_TYPE_DIALOG"
r <- io $ getWindowProperty32 dpy w_type w
return $ case r of
Just xs -> fromIntegral w_dialog `elem` xs
_ -> False
-- | A predicate to check whether a window is Transient.
-- It holds the result which might be the window it is transient to
-- or it might be 'Nothing'.