From 90949577aeb040012a49c7687bcfec8fcfb80e34 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Sat, 17 Jan 2009 05:04:32 +0100 Subject: Add XMonad.Actions.SpawnOn Ignore-this: 63869d1ab11f2ed5aab1690763065800 darcs-hash:20090117040432-25a6b-306aa18fed69a47197ca8c349cf6452939db5188.gz --- XMonad/Hooks/ManageHelpers.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'XMonad/Hooks/ManageHelpers.hs') diff --git a/XMonad/Hooks/ManageHelpers.hs b/XMonad/Hooks/ManageHelpers.hs index 5dd8e32..e5f25e4 100644 --- a/XMonad/Hooks/ManageHelpers.hs +++ b/XMonad/Hooks/ManageHelpers.hs @@ -31,6 +31,7 @@ module XMonad.Hooks.ManageHelpers ( isKDETrayWindow, isFullscreen, isDialog, + pid, transientTo, maybeToDefinite, MaybeManageHook, @@ -49,6 +50,8 @@ import qualified XMonad.StackSet as W import Data.Maybe import Data.Monoid +import System.Posix (ProcessID) + -- | Denotes a side of a screen. @S@ stands for South, @NE@ for Northwest -- etc. @C@ stands for Center. data Side = SC | NC | CE | CW | SE | SW | NE | NW | C @@ -144,6 +147,15 @@ isDialog = ask >>= \w -> liftX $ do Just xs -> fromIntegral w_dialog `elem` xs _ -> False +pid :: Query (Maybe ProcessID) +pid = ask >>= \w -> liftX $ do + dpy <- asks display + a <- getAtom "_NET_WM_PID" + p <- io $ getWindowProperty32 dpy a w + return $ case p of + Just [x] -> Just (fromIntegral x) + _ -> Nothing + -- | 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'. -- cgit v1.2.3