aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorLukas Mai <l.mai@web.de>2008-04-26 15:27:45 +0200
committerLukas Mai <l.mai@web.de>2008-04-26 15:27:45 +0200
commit265921468cbde34f5ea6065739fb09b8a24efbc5 (patch)
tree57eb70bf64b9acd6b7b4148c23c21d25a1440fdf /XMonad
parent4ceec744e50a587bc5312d19172975c1c8845007 (diff)
downloadXMonadContrib-265921468cbde34f5ea6065739fb09b8a24efbc5.tar.gz
XMonadContrib-265921468cbde34f5ea6065739fb09b8a24efbc5.tar.xz
XMonadContrib-265921468cbde34f5ea6065739fb09b8a24efbc5.zip
XMonad.Hooks.ManageHelpers: quick&dirty support for _NET_WM_STATE_FULLSCREEN
darcs-hash:20080426132745-462cf-ebe055cea6b3fd583036d24280d1a739c714db1c.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Hooks/ManageHelpers.hs23
1 files changed, 21 insertions, 2 deletions
diff --git a/XMonad/Hooks/ManageHelpers.hs b/XMonad/Hooks/ManageHelpers.hs
index c965c17..20756f0 100644
--- a/XMonad/Hooks/ManageHelpers.hs
+++ b/XMonad/Hooks/ManageHelpers.hs
@@ -8,8 +8,8 @@
-- Stability : unstable
-- Portability : unportable
--
--- This module provides helper functions to be used in @manageHook@. Here's how you
--- might use this:
+-- This module provides helper functions to be used in @manageHook@. Here's
+-- how you might use this:
--
-- > import XMonad.Hooks.ManageHelpers
-- > main =
@@ -18,6 +18,7 @@
-- > manageHook = composeOne [
-- > isKDETrayWindow -?> doIgnore,
-- > transience,
+-- > isFullscreen -?> doFullFloat,
-- > resource =? "stalonetray" -?> doIgnore
-- > ],
-- > ...
@@ -27,12 +28,14 @@ module XMonad.Hooks.ManageHelpers (
composeOne,
(-?>), (/=?), (<==?), (</=?), (-->>), (-?>>),
isKDETrayWindow,
+ isFullscreen,
transientTo,
maybeToDefinite,
MaybeManageHook,
transience,
transience',
doRectFloat,
+ doFullFloat,
doCenterFloat
) where
@@ -109,6 +112,18 @@ isKDETrayWindow = ask >>= \w -> liftX $ do
Just [_] -> True
_ -> False
+-- | A predicate to check whether a window wants to fill the whole screen.
+-- See also 'doFullFloat'.
+isFullscreen :: Query Bool
+isFullscreen = ask >>= \w -> liftX $ do
+ dpy <- asks display
+ state <- getAtom "_NET_WM_STATE"
+ full <- getAtom "_NET_WM_STATE_FULLSCREEN"
+ r <- io $ getWindowProperty32 dpy state w
+ return $ case r of
+ Just xs -> fromIntegral full `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'.
@@ -140,6 +155,10 @@ doRectFloat :: W.RationalRect -- ^ The rectangle to float the window in. 0 to 1
-> ManageHook
doRectFloat r = ask >>= \w -> doF (W.float w r)
+-- | Floats the window and makes it use the whole screen. Equivalent to
+-- @'doRectFloat' $ 'W.RationalRect' 0 0 1 1@.
+doFullFloat :: ManageHook
+doFullFloat = doRectFloat $ W.RationalRect 0 0 1 1
-- | Floats a new window with its original size, but centered.
doCenterFloat :: ManageHook