mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.U.PureX: Add focusWindow and focusNth
This can be used to reduce flicker in noop focus actions.
This commit is contained in:
parent
f271d59c34
commit
6db6854752
@ -256,6 +256,11 @@
|
|||||||
- Added `workspaceNamesListTransform` which makes workspace names visible
|
- Added `workspaceNamesListTransform` which makes workspace names visible
|
||||||
to external pagers.
|
to external pagers.
|
||||||
|
|
||||||
|
* `XMonad.Util.PureX`
|
||||||
|
|
||||||
|
- Added `focusWindow` and `focusNth` which don't refresh (and thus
|
||||||
|
possibly flicker) when they happen to be a no-op.
|
||||||
|
|
||||||
* Several `LayoutClass` instances now have an additional `Typeable`
|
* Several `LayoutClass` instances now have an additional `Typeable`
|
||||||
constraint which may break some advanced configs. The upside is that we
|
constraint which may break some advanced configs. The upside is that we
|
||||||
can now add `Typeable` to `LayoutClass` in `XMonad.Core` and make it
|
can now add `Typeable` to `LayoutClass` in `XMonad.Core` and make it
|
||||||
|
@ -44,6 +44,7 @@ module XMonad.Util.PureX (
|
|||||||
withWindowSet', withFocii,
|
withWindowSet', withFocii,
|
||||||
modify'', modifyWindowSet',
|
modify'', modifyWindowSet',
|
||||||
getStack, putStack, peek,
|
getStack, putStack, peek,
|
||||||
|
focusWindow, focusNth,
|
||||||
view, greedyView, invisiView,
|
view, greedyView, invisiView,
|
||||||
shift, curScreen, curWorkspace,
|
shift, curScreen, curWorkspace,
|
||||||
curTag, curScreenId,
|
curTag, curScreenId,
|
||||||
@ -52,6 +53,7 @@ module XMonad.Util.PureX (
|
|||||||
-- xmonad
|
-- xmonad
|
||||||
import XMonad
|
import XMonad
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
import qualified XMonad.Actions.FocusNth
|
||||||
|
|
||||||
-- mtl
|
-- mtl
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
@ -272,5 +274,21 @@ shift tag = withFocii $ \ctag fw ->
|
|||||||
mfw' <- peek
|
mfw' <- peek
|
||||||
return (Any $ Just fw /= mfw')
|
return (Any $ Just fw /= mfw')
|
||||||
|
|
||||||
|
-- | Internal. Refresh-tracking logic of focus operations.
|
||||||
|
focusWith :: XLike m => (WindowSet -> WindowSet) -> m Any
|
||||||
|
focusWith focuser = do
|
||||||
|
old <- peek
|
||||||
|
modifyWindowSet' focuser
|
||||||
|
new <- peek
|
||||||
|
return (Any $ old /= new)
|
||||||
|
|
||||||
|
-- | A refresh-tracking version of @W.focusWindow@.
|
||||||
|
focusWindow :: XLike m => Window -> m Any
|
||||||
|
focusWindow w = focusWith (W.focusWindow w)
|
||||||
|
|
||||||
|
-- | A refresh-tracking version of @XMonad.Actions.FocusNth.focusNth@.
|
||||||
|
focusNth :: XLike m => Int -> m Any
|
||||||
|
focusNth i = focusWith (W.modify' (XMonad.Actions.FocusNth.focusNth' i))
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user