mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-04 06:01:52 -07:00
Provide means to find original window by its decoration.
In order to enable user to write custom `decorationMouseFocusHook' and `decorationMouseDragHook' hooks we need to provide him with means to lookup original window by its decoration. Module Decoration has internal function `lookFor' for exactly the same purpose. I exported it under a slightly different name and without exposing internals of DecorationState.
This commit is contained in:
@@ -26,6 +26,7 @@ module XMonad.Layout.Decoration
|
|||||||
, Shrinker (..), DefaultShrinker
|
, Shrinker (..), DefaultShrinker
|
||||||
, shrinkText, CustomShrink ( CustomShrink ), shrinkWhile
|
, shrinkText, CustomShrink ( CustomShrink ), shrinkWhile
|
||||||
, isInStack, isVisible, isInvisible, isWithin, fi
|
, isInStack, isVisible, isInvisible, isWithin, fi
|
||||||
|
, findWindowByDecoration
|
||||||
, module XMonad.Layout.LayoutModifier
|
, module XMonad.Layout.LayoutModifier
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -307,6 +308,9 @@ lookFor w ((wr,(Just dw,dr)):dwrs) | w == dw = Just (wr,(dw,dr))
|
|||||||
lookFor w ((_, (Nothing, _)):dwrs) = lookFor w dwrs
|
lookFor w ((_, (Nothing, _)):dwrs) = lookFor w dwrs
|
||||||
lookFor _ [] = Nothing
|
lookFor _ [] = Nothing
|
||||||
|
|
||||||
|
findWindowByDecoration :: Window -> DecorationState -> Maybe (OrigWin,(Window,Maybe Rectangle))
|
||||||
|
findWindowByDecoration w ds = lookFor w (decos ds)
|
||||||
|
|
||||||
-- | Initialize the 'DecorationState' by initializing the font
|
-- | Initialize the 'DecorationState' by initializing the font
|
||||||
-- structure and by creating the needed decorations.
|
-- structure and by creating the needed decorations.
|
||||||
initState :: DecorationStyle ds Window => Theme -> ds Window -> Rectangle
|
initState :: DecorationStyle ds Window => Theme -> ds Window -> Rectangle
|
||||||
|
Reference in New Issue
Block a user