diff --git a/CHANGES.md b/CHANGES.md index c4cf9bf4..ad8c6e98 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -491,6 +491,8 @@ - Added `focusWindow` and `focusNth` which don't refresh (and thus possibly flicker) when they happen to be a no-op. + - Added `shiftWin` as a refresh tracking version of `W.shiftWin`. + * Several `LayoutClass` instances now have an additional `Typeable` constraint which may break some advanced configs. The upside is that we can now add `Typeable` to `LayoutClass` in `XMonad.Core` and make it diff --git a/XMonad/Util/PureX.hs b/XMonad/Util/PureX.hs index f5014674..bf83d80e 100644 --- a/XMonad/Util/PureX.hs +++ b/XMonad/Util/PureX.hs @@ -46,7 +46,7 @@ module XMonad.Util.PureX ( getStack, putStack, peek, focusWindow, focusNth, view, greedyView, invisiView, - shift, curScreen, curWorkspace, + shift, shiftWin, curScreen, curWorkspace, curTag, curScreenId, ) where @@ -271,6 +271,16 @@ shift tag = withFocii $ \ctag fw -> mfw' <- peek return (Any $ Just fw /= mfw') +-- | A refresh tracking version of @W.shiftWin@. +shiftWin :: XLike m => WorkspaceId -> Window -> m Any +shiftWin tag w = do + mtag <- gets $ W.findTag w . windowset + whenJust' mtag $ \wtag -> + when' (tag /= wtag) $ do + modifyWindowSet' $ W.shiftWin tag w + ntag <- gets $ W.findTag w . windowset + return (Any $ mtag /= ntag) + -- | Internal. Refresh-tracking logic of focus operations. focusWith :: XLike m => (WindowSet -> WindowSet) -> m Any focusWith focuser = do