mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
EwmhDesktops: Cache active window as well
This commit is contained in:
parent
f6f925c823
commit
8c309f87b8
@ -90,6 +90,15 @@ data DesktopState
|
|||||||
instance ExtensionClass DesktopState where
|
instance ExtensionClass DesktopState where
|
||||||
initialValue = DesktopState [] [] Nothing M.empty
|
initialValue = DesktopState [] [] Nothing M.empty
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- The value of @_NET_ACTIVE_WINDOW@, cached to avoid unnecessary property
|
||||||
|
-- updates.
|
||||||
|
newtype ActiveWindow = ActiveWindow Window
|
||||||
|
deriving (Eq)
|
||||||
|
|
||||||
|
instance ExtensionClass ActiveWindow where
|
||||||
|
initialValue = ActiveWindow none
|
||||||
|
|
||||||
toDesktopState :: ([WindowSpace] -> [WindowSpace]) -> WindowSet -> DesktopState
|
toDesktopState :: ([WindowSpace] -> [WindowSpace]) -> WindowSet -> DesktopState
|
||||||
toDesktopState f s =
|
toDesktopState f s =
|
||||||
DesktopState
|
DesktopState
|
||||||
@ -135,8 +144,9 @@ ewmhDesktopsLogHookCustom f = withWindowSet $ \s -> do
|
|||||||
|
|
||||||
mapM_ (uncurry setWindowDesktop) (M.toList $ windowDesktops s')
|
mapM_ (uncurry setWindowDesktop) (M.toList $ windowDesktops s')
|
||||||
|
|
||||||
setActiveWindow
|
let activeWindow' = fromMaybe none (W.peek s)
|
||||||
|
whenChanged (ActiveWindow activeWindow') $ do
|
||||||
|
setActiveWindow activeWindow'
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- Intercepts messages from pagers and similar applications and reacts on them.
|
-- Intercepts messages from pagers and similar applications and reacts on them.
|
||||||
@ -283,9 +293,8 @@ setSupported = withDisplay $ \dpy -> do
|
|||||||
|
|
||||||
setWMName "xmonad"
|
setWMName "xmonad"
|
||||||
|
|
||||||
setActiveWindow :: X ()
|
setActiveWindow :: Window -> X ()
|
||||||
setActiveWindow = withWindowSet $ \s -> withDisplay $ \dpy -> do
|
setActiveWindow w = withDisplay $ \dpy -> do
|
||||||
let w = fromMaybe none (W.peek s)
|
|
||||||
r <- asks theRoot
|
r <- asks theRoot
|
||||||
a <- getAtom "_NET_ACTIVE_WINDOW"
|
a <- getAtom "_NET_ACTIVE_WINDOW"
|
||||||
c <- getAtom "WINDOW"
|
c <- getAtom "WINDOW"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user