mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -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
|
||||
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 f s =
|
||||
DesktopState
|
||||
@ -135,8 +144,9 @@ ewmhDesktopsLogHookCustom f = withWindowSet $ \s -> do
|
||||
|
||||
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.
|
||||
@ -283,9 +293,8 @@ setSupported = withDisplay $ \dpy -> do
|
||||
|
||||
setWMName "xmonad"
|
||||
|
||||
setActiveWindow :: X ()
|
||||
setActiveWindow = withWindowSet $ \s -> withDisplay $ \dpy -> do
|
||||
let w = fromMaybe none (W.peek s)
|
||||
setActiveWindow :: Window -> X ()
|
||||
setActiveWindow w = withDisplay $ \dpy -> do
|
||||
r <- asks theRoot
|
||||
a <- getAtom "_NET_ACTIVE_WINDOW"
|
||||
c <- getAtom "WINDOW"
|
||||
|
Loading…
x
Reference in New Issue
Block a user