{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# OPTIONS_HADDOCK show-extensions #-}
module XMonad.Hooks.Focus
(
Focus (..)
, FocusLock (..)
, toggleLock
, focusLockOn
, focusLockOff
, FocusQuery
, runFocusQuery
, FocusHook
, liftQuery
, new
, focused
, focused'
, focusedOn
, focusedOn'
, focusedCur
, focusedCur'
, newOn
, newOnCur
, unlessFocusLock
, keepFocus
, switchFocus
, keepWorkspace
, switchWorkspace
, manageFocus
, activateSwitchWs
, activateOnCurrentWs
, activateOnCurrentKeepFocus
)
where
import Control.Arrow ((&&&))
import Control.Monad.Reader
import XMonad
import XMonad.Prelude
import qualified XMonad.StackSet as W
import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Hooks.ManageHelpers (currentWs)
data Focus = Focus
{
Focus -> WorkspaceId
newWorkspace :: WorkspaceId
, Focus -> Maybe Window
focusedWindow :: Maybe Window
, Focus -> WorkspaceId
currentWorkspace :: WorkspaceId
}
deriving (Int -> Focus -> ShowS
[Focus] -> ShowS
Focus -> WorkspaceId
forall a.
(Int -> a -> ShowS)
-> (a -> WorkspaceId) -> ([a] -> ShowS) -> Show a
showList :: [Focus] -> ShowS
$cshowList :: [Focus] -> ShowS
show :: Focus -> WorkspaceId
$cshow :: Focus -> WorkspaceId
showsPrec :: Int -> Focus -> ShowS
$cshowsPrec :: Int -> Focus -> ShowS
Show)
instance Default Focus where
def :: Focus
def = Focus
{ focusedWindow :: Maybe Window
focusedWindow = forall a. Maybe a
Nothing
, newWorkspace :: WorkspaceId
newWorkspace = WorkspaceId
""
, currentWorkspace :: WorkspaceId
currentWorkspace = WorkspaceId
""
}
newtype FocusLock = FocusLock {FocusLock -> Bool
getFocusLock :: Bool}
deriving (Int -> FocusLock -> ShowS
[FocusLock] -> ShowS
FocusLock -> WorkspaceId
forall a.
(Int -> a -> ShowS)
-> (a -> WorkspaceId) -> ([a] -> ShowS) -> Show a
showList :: [FocusLock] -> ShowS
$cshowList :: [FocusLock] -> ShowS
show :: FocusLock -> WorkspaceId
$cshow :: FocusLock -> WorkspaceId
showsPrec :: Int -> FocusLock -> ShowS
$cshowsPrec :: Int -> FocusLock -> ShowS
Show)
instance ExtensionClass FocusLock where
initialValue :: FocusLock
initialValue = Bool -> FocusLock
FocusLock Bool
False
toggleLock :: X ()
toggleLock :: X ()
toggleLock = forall a (m :: * -> *).
(ExtensionClass a, XLike m) =>
(a -> a) -> m ()
XS.modify (\(FocusLock Bool
b) -> Bool -> FocusLock
FocusLock (Bool -> Bool
not Bool
b))
focusLockOn :: X ()
focusLockOn :: X ()
focusLockOn = forall a (m :: * -> *).
(ExtensionClass a, XLike m) =>
(a -> a) -> m ()
XS.modify (forall a b. a -> b -> a
const (Bool -> FocusLock
FocusLock Bool
True))
focusLockOff :: X ()
focusLockOff :: X ()
focusLockOff = forall a (m :: * -> *).
(ExtensionClass a, XLike m) =>
(a -> a) -> m ()
XS.modify (forall a b. a -> b -> a
const (Bool -> FocusLock
FocusLock Bool
False))
newtype FocusQuery a = FocusQuery (ReaderT Focus Query a)
deriving newtype (forall a b. a -> FocusQuery b -> FocusQuery a
forall a b. (a -> b) -> FocusQuery a -> FocusQuery b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> FocusQuery b -> FocusQuery a
$c<$ :: forall a b. a -> FocusQuery b -> FocusQuery a
fmap :: forall a b. (a -> b) -> FocusQuery a -> FocusQuery b
$cfmap :: forall a b. (a -> b) -> FocusQuery a -> FocusQuery b
Functor, Functor FocusQuery
forall a. a -> FocusQuery a
forall a b. FocusQuery a -> FocusQuery b -> FocusQuery a
forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
forall a b. FocusQuery (a -> b) -> FocusQuery a -> FocusQuery b
forall a b c.
(a -> b -> c) -> FocusQuery a -> FocusQuery b -> FocusQuery c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery a
$c<* :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery a
*> :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
$c*> :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
liftA2 :: forall a b c.
(a -> b -> c) -> FocusQuery a -> FocusQuery b -> FocusQuery c
$cliftA2 :: forall a b c.
(a -> b -> c) -> FocusQuery a -> FocusQuery b -> FocusQuery c
<*> :: forall a b. FocusQuery (a -> b) -> FocusQuery a -> FocusQuery b
$c<*> :: forall a b. FocusQuery (a -> b) -> FocusQuery a -> FocusQuery b
pure :: forall a. a -> FocusQuery a
$cpure :: forall a. a -> FocusQuery a
Applicative, Applicative FocusQuery
forall a. a -> FocusQuery a
forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
forall a b. FocusQuery a -> (a -> FocusQuery b) -> FocusQuery b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> FocusQuery a
$creturn :: forall a. a -> FocusQuery a
>> :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
$c>> :: forall a b. FocusQuery a -> FocusQuery b -> FocusQuery b
>>= :: forall a b. FocusQuery a -> (a -> FocusQuery b) -> FocusQuery b
$c>>= :: forall a b. FocusQuery a -> (a -> FocusQuery b) -> FocusQuery b
Monad, MonadReader Focus, Monad FocusQuery
forall a. IO a -> FocusQuery a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: forall a. IO a -> FocusQuery a
$cliftIO :: forall a. IO a -> FocusQuery a
MonadIO)
deriving (NonEmpty (FocusQuery a) -> FocusQuery a
FocusQuery a -> FocusQuery a -> FocusQuery a
forall b. Integral b => b -> FocusQuery a -> FocusQuery a
forall a. Semigroup a => NonEmpty (FocusQuery a) -> FocusQuery a
forall a.
Semigroup a =>
FocusQuery a -> FocusQuery a -> FocusQuery a
forall a b.
(Semigroup a, Integral b) =>
b -> FocusQuery a -> FocusQuery a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> FocusQuery a -> FocusQuery a
$cstimes :: forall a b.
(Semigroup a, Integral b) =>
b -> FocusQuery a -> FocusQuery a
sconcat :: NonEmpty (FocusQuery a) -> FocusQuery a
$csconcat :: forall a. Semigroup a => NonEmpty (FocusQuery a) -> FocusQuery a
<> :: FocusQuery a -> FocusQuery a -> FocusQuery a
$c<> :: forall a.
Semigroup a =>
FocusQuery a -> FocusQuery a -> FocusQuery a
Semigroup, FocusQuery a
[FocusQuery a] -> FocusQuery a
FocusQuery a -> FocusQuery a -> FocusQuery a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall {a}. Monoid a => Semigroup (FocusQuery a)
forall a. Monoid a => FocusQuery a
forall a. Monoid a => [FocusQuery a] -> FocusQuery a
forall a. Monoid a => FocusQuery a -> FocusQuery a -> FocusQuery a
mconcat :: [FocusQuery a] -> FocusQuery a
$cmconcat :: forall a. Monoid a => [FocusQuery a] -> FocusQuery a
mappend :: FocusQuery a -> FocusQuery a -> FocusQuery a
$cmappend :: forall a. Monoid a => FocusQuery a -> FocusQuery a -> FocusQuery a
mempty :: FocusQuery a
$cmempty :: forall a. Monoid a => FocusQuery a
Monoid) via Ap FocusQuery a
runFocusQuery :: FocusQuery a -> Focus -> Query a
runFocusQuery :: forall a. FocusQuery a -> Focus -> Query a
runFocusQuery (FocusQuery ReaderT Focus Query a
m) = forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT ReaderT Focus Query a
m
type FocusHook = FocusQuery (Endo WindowSet)
liftQuery :: Query a -> FocusQuery a
liftQuery :: forall a. Query a -> FocusQuery a
liftQuery = forall a. ReaderT Focus Query a -> FocusQuery a
FocusQuery forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift
new :: Query a -> FocusQuery a
new :: forall a. Query a -> FocusQuery a
new = forall a. Query a -> FocusQuery a
liftQuery
focused :: Query Bool -> FocusQuery Bool
focused :: Query Bool -> FocusQuery Bool
focused Query Bool
m = Any -> Bool
getAny forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Monoid a => Query a -> FocusQuery a
focused' (Bool -> Any
Any forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Query Bool
m)
focused' :: Monoid a => Query a -> FocusQuery a
focused' :: forall a. Monoid a => Query a -> FocusQuery a
focused' Query a
m = do
Maybe Window
mw <- forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Focus -> Maybe Window
focusedWindow
forall a. Query a -> FocusQuery a
liftQuery (forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Monoid a => a
mempty (forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local Query a
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> b -> a
const) Maybe Window
mw)
focusedOn :: WorkspaceId -> Query Bool -> FocusQuery Bool
focusedOn :: WorkspaceId -> Query Bool -> FocusQuery Bool
focusedOn WorkspaceId
i Query Bool
m = Any -> Bool
getAny forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Monoid a => WorkspaceId -> Query a -> FocusQuery a
focusedOn' WorkspaceId
i (Bool -> Any
Any forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Query Bool
m)
focusedOn' :: Monoid a => WorkspaceId -> Query a -> FocusQuery a
focusedOn' :: forall a. Monoid a => WorkspaceId -> Query a -> FocusQuery a
focusedOn' WorkspaceId
i Query a
m = forall a. Query a -> FocusQuery a
liftQuery forall a b. (a -> b) -> a -> b
$ do
Maybe Window
mw <- forall a. X a -> Query a
liftX forall a b. (a -> b) -> a -> b
$ forall a. (WindowSet -> X a) -> X a
withWindowSet (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a s sd. StackSet i l a s sd -> Maybe a
W.peek forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view WorkspaceId
i)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Monoid a => a
mempty (forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local Query a
m forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> b -> a
const) Maybe Window
mw
focusedCur :: Query Bool -> FocusQuery Bool
focusedCur :: Query Bool -> FocusQuery Bool
focusedCur Query Bool
m = Any -> Bool
getAny forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Monoid a => Query a -> FocusQuery a
focusedCur' (Bool -> Any
Any forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Query Bool
m)
focusedCur' :: Monoid a => Query a -> FocusQuery a
focusedCur' :: forall a. Monoid a => Query a -> FocusQuery a
focusedCur' Query a
m = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Focus -> WorkspaceId
currentWorkspace forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \WorkspaceId
i -> forall a. Monoid a => WorkspaceId -> Query a -> FocusQuery a
focusedOn' WorkspaceId
i Query a
m
newOn :: WorkspaceId -> FocusQuery Bool
newOn :: WorkspaceId -> FocusQuery Bool
newOn WorkspaceId
i = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks ((WorkspaceId
i forall a. Eq a => a -> a -> Bool
==) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Focus -> WorkspaceId
newWorkspace)
newOnCur :: FocusQuery Bool
newOnCur :: FocusQuery Bool
newOnCur = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Focus -> WorkspaceId
currentWorkspace forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= WorkspaceId -> FocusQuery Bool
newOn
unlessFocusLock :: Monoid a => Query a -> Query a
unlessFocusLock :: forall a. Monoid a => Query a -> Query a
unlessFocusLock Query a
m = do
FocusLock Bool
b <- forall a. X a -> Query a
liftX forall a (m :: * -> *). (ExtensionClass a, XLike m) => m a
XS.get
forall (m :: * -> *) a. (Monad m, Monoid a) => Bool -> m a -> m a
when' (Bool -> Bool
not Bool
b) Query a
m
keepFocus :: FocusHook
keepFocus :: FocusHook
keepFocus = forall a. Monoid a => Query a -> FocusQuery a
focused' forall a b. (a -> b) -> a -> b
$ forall r (m :: * -> *). MonadReader r m => m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Window
w -> forall s. (s -> s) -> Query (Endo s)
doF forall a b. (a -> b) -> a -> b
$ \WindowSet
ws ->
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view (forall i l a s sd. StackSet i l a s sd -> i
W.currentTag WindowSet
ws) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a i l sd.
(Eq s, Eq a, Eq i) =>
a -> StackSet i l a s sd -> StackSet i l a s sd
W.focusWindow Window
w forall a b. (a -> b) -> a -> b
$ WindowSet
ws
switchFocus :: FocusHook
switchFocus :: FocusHook
switchFocus = do
FocusLock Bool
b <- forall a. Query a -> FocusQuery a
liftQuery forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. X a -> Query a
liftX forall a b. (a -> b) -> a -> b
$ forall a (m :: * -> *). (ExtensionClass a, XLike m) => m a
XS.get
if Bool
b
then FocusHook
keepFocus
else forall a. Query a -> FocusQuery a
new forall a b. (a -> b) -> a -> b
$ forall r (m :: * -> *). MonadReader r m => m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Window
w -> forall s. (s -> s) -> Query (Endo s)
doF forall a b. (a -> b) -> a -> b
$ \WindowSet
ws ->
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view (forall i l a s sd. StackSet i l a s sd -> i
W.currentTag WindowSet
ws) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a i l sd.
(Eq s, Eq a, Eq i) =>
a -> StackSet i l a s sd -> StackSet i l a s sd
W.focusWindow Window
w forall a b. (a -> b) -> a -> b
$ WindowSet
ws
keepWorkspace :: FocusHook
keepWorkspace :: FocusHook
keepWorkspace = do
WorkspaceId
ws <- forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Focus -> WorkspaceId
currentWorkspace
forall a. Query a -> FocusQuery a
liftQuery forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. (s -> s) -> Query (Endo s)
doF forall a b. (a -> b) -> a -> b
$ forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view WorkspaceId
ws
switchWorkspace :: FocusHook
switchWorkspace :: FocusHook
switchWorkspace = do
FocusLock Bool
b <- forall a. Query a -> FocusQuery a
liftQuery forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. X a -> Query a
liftX forall a b. (a -> b) -> a -> b
$ forall a (m :: * -> *). (ExtensionClass a, XLike m) => m a
XS.get
if Bool
b
then FocusHook
keepWorkspace
else do
WorkspaceId
ws <- forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Focus -> WorkspaceId
newWorkspace
forall a. Query a -> FocusQuery a
liftQuery forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. (s -> s) -> Query (Endo s)
doF forall a b. (a -> b) -> a -> b
$ forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view WorkspaceId
ws
manageFocus :: FocusHook -> ManageHook
manageFocus :: FocusHook -> ManageHook
manageFocus FocusHook
m = do
[(WorkspaceId, Maybe Window)]
fws <- forall a. X a -> Query a
liftX forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (WindowSet -> X a) -> X a
withWindowSet forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => a -> m a
return
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map (forall i l a. Workspace i l a -> i
W.tag forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Stack a -> a
W.focus forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a. Workspace i l a -> Maybe (Stack a)
W.stack) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a s sd. StackSet i l a s sd -> [Workspace i l a]
W.workspaces
WorkspaceId
ct <- Query WorkspaceId
currentWs
let r :: Focus
r = forall a. Default a => a
def {currentWorkspace :: WorkspaceId
currentWorkspace = WorkspaceId
ct}
[(WorkspaceId, Endo WindowSet)]
hs <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [(WorkspaceId, Maybe Window)]
fws forall a b. (a -> b) -> a -> b
$ \(WorkspaceId
i, Maybe Window
mw) -> do
Endo WindowSet
f <- forall a. FocusQuery a -> Focus -> Query a
runFocusQuery FocusHook
m (Focus
r {focusedWindow :: Maybe Window
focusedWindow = Maybe Window
mw, newWorkspace :: WorkspaceId
newWorkspace = WorkspaceId
i})
forall (m :: * -> *) a. Monad m => a -> m a
return (WorkspaceId
i, Endo WindowSet
f)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
reader ([(WorkspaceId, Endo WindowSet)] -> Window -> WindowSet -> WindowSet
selectHook [(WorkspaceId, Endo WindowSet)]
hs) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall s. (s -> s) -> Query (Endo s)
doF
where
selectHook :: [(WorkspaceId, Endo WindowSet)] -> Window -> WindowSet -> WindowSet
selectHook :: [(WorkspaceId, Endo WindowSet)] -> Window -> WindowSet -> WindowSet
selectHook [(WorkspaceId, Endo WindowSet)]
cfs Window
nw WindowSet
ws = forall a. a -> Maybe a -> a
fromMaybe WindowSet
ws forall a b. (a -> b) -> a -> b
$ do
WorkspaceId
i <- forall a i l s sd. Eq a => a -> StackSet i l a s sd -> Maybe i
W.findTag Window
nw WindowSet
ws
Endo WindowSet
f <- forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup WorkspaceId
i [(WorkspaceId, Endo WindowSet)]
cfs
forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. Endo a -> a -> a
appEndo Endo WindowSet
f WindowSet
ws)
when' :: (Monad m, Monoid a) => Bool -> m a -> m a
when' :: forall (m :: * -> *) a. (Monad m, Monoid a) => Bool -> m a -> m a
when' Bool
b m a
mx
| Bool
b = m a
mx
| Bool
otherwise = forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Monoid a => a
mempty
activateSwitchWs :: ManageHook
activateSwitchWs :: ManageHook
activateSwitchWs = FocusHook -> ManageHook
manageFocus (FocusHook
switchWorkspace forall a. Semigroup a => a -> a -> a
<> FocusHook
switchFocus)
activateOnCurrent' :: ManageHook
activateOnCurrent' :: ManageHook
activateOnCurrent' = Query WorkspaceId
currentWs forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a. Monoid a => Query a -> Query a
unlessFocusLock forall b c a. (b -> c) -> (a -> b) -> a -> c
. WorkspaceId -> ManageHook
doShift
activateOnCurrentWs :: ManageHook
activateOnCurrentWs :: ManageHook
activateOnCurrentWs = FocusHook -> ManageHook
manageFocus (FocusQuery Bool
newOnCur forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> FocusHook
switchFocus) forall a. Semigroup a => a -> a -> a
<> ManageHook
activateOnCurrent'
activateOnCurrentKeepFocus :: ManageHook
activateOnCurrentKeepFocus :: ManageHook
activateOnCurrentKeepFocus = FocusHook -> ManageHook
manageFocus (FocusQuery Bool
newOnCur forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> FocusHook
keepFocus) forall a. Semigroup a => a -> a -> a
<> ManageHook
activateOnCurrent'