diff options
author | mail <mail@joachim-breitner.de> | 2007-10-06 15:28:02 +0200 |
---|---|---|
committer | mail <mail@joachim-breitner.de> | 2007-10-06 15:28:02 +0200 |
commit | 1c54d11f556ef4850165832072ccbed55e417f4e (patch) | |
tree | c5a5cc9a6711104cde9aa624faa37a347204e54c | |
parent | 9cead4a60e4eb68a19b76e066e796847a6aef8cb (diff) | |
download | XMonadContrib-1c54d11f556ef4850165832072ccbed55e417f4e.tar.gz XMonadContrib-1c54d11f556ef4850165832072ccbed55e417f4e.tar.xz XMonadContrib-1c54d11f556ef4850165832072ccbed55e417f4e.zip |
(un)Manage Docks based on WINDOW_TYPE
Hi,
this is a replacement for the example code in Config.hs that should detect
and unamange, for example, the gnome-panel.
The problem with that code is that it also unamangs dialog boxes from gnome-panel
which then are not usable (no keyboard intput, at least here).
Greetings,
Joachim
darcs-hash:20071006132802-c9905-befdbe36f6f280d987dfb62702b7a6e05ce3306c.gz
-rw-r--r-- | ManageDocks.hs | 59 | ||||
-rw-r--r-- | MetaModule.hs | 1 |
2 files changed, 60 insertions, 0 deletions
diff --git a/ManageDocks.hs b/ManageDocks.hs new file mode 100644 index 0000000..f487a60 --- /dev/null +++ b/ManageDocks.hs @@ -0,0 +1,59 @@ +----------------------------------------------------------------------------- +-- | +-- Module : XMonadContrib.ManageDocks +-- Copyright : (c) Joachim Breitner <mail@joachim-breitner.de> +-- License : BSD +-- +-- Maintainer : Joachim Breitner <mail@joachim-breitner.de> +-- Stability : unstable +-- Portability : unportable +-- +-- Makes xmonad detect windows with type DOCK and does not put them in +-- layouts. +----------------------------------------------------------------------------- +module XMonadContrib.ManageDocks ( + -- * Usage + -- $usage + manageDocksHook + ) where + +import Control.Monad.Reader +import XMonad +import Operations +import qualified StackSet as W +import Graphics.X11.Xlib +import Graphics.X11.Xlib.Extras + +-- $usage +-- Add the imports to your configuration file and add the mangeHook: +-- +-- > import XMonadContrib.ManageDocks +-- +-- > manageHook w _ _ _ = manageDocksHook w + +-- %import XMonadContrib.ManageDocks +-- %def -- comment out default manageHook definition above if you uncomment this: +-- %def manageHook _ _ _ = manageDocksHook w + + +-- | +-- Deteckts if the given window is of type DOCK and if so, reveals it, but does +-- not manage it +manageDocksHook :: Window -> X (WindowSet -> WindowSet) +manageDocksHook w = do + isDock <- checkDock w + if isDock then do + reveal w + return (W.delete w) + else do + return id + +checkDock :: Window -> X (Bool) +checkDock w = do + a <- getAtom "_NET_WM_WINDOW_TYPE" + d <- getAtom "_NET_WM_WINDOW_TYPE_DOCK" + mbr <- withDisplay $ \dpy -> do + io $ getWindowProperty32 dpy a w + case mbr of + Just [r] -> return (r == d) + _ -> return False diff --git a/MetaModule.hs b/MetaModule.hs index 2b4b210..07fbf49 100644 --- a/MetaModule.hs +++ b/MetaModule.hs @@ -48,6 +48,7 @@ import XMonadContrib.LayoutModifier () import XMonadContrib.LayoutHints () import XMonadContrib.LayoutScreens () import XMonadContrib.MagicFocus () +import XMonadContrib.ManageDocks () -- import XMonadContrib.Magnifier () import XMonadContrib.Maximize () -- import XMonadContrib.Mosaic () |