mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Add switchTopicWith
This commit is contained in:
parent
1400d167ad
commit
ae6c658bc4
@ -31,6 +31,7 @@ module XMonad.Actions.TopicSpace
|
|||||||
, topicAction
|
, topicAction
|
||||||
, currentTopicAction
|
, currentTopicAction
|
||||||
, switchTopic
|
, switchTopic
|
||||||
|
, switchTopicWith
|
||||||
, switchNthLastFocused
|
, switchNthLastFocused
|
||||||
, switchNthLastFocusedExclude
|
, switchNthLastFocusedExclude
|
||||||
, shiftNthLastFocused
|
, shiftNthLastFocused
|
||||||
@ -318,10 +319,15 @@ currentTopicAction tg = topicAction tg =<< gets (W.tag . W.workspace . W.current
|
|||||||
|
|
||||||
-- | Switch to the given topic.
|
-- | Switch to the given topic.
|
||||||
switchTopic :: TopicConfig -> Topic -> X ()
|
switchTopic :: TopicConfig -> Topic -> X ()
|
||||||
switchTopic tg topic = do
|
switchTopic = switchTopicWith (const True)
|
||||||
|
|
||||||
|
-- | Like 'switchTopic', but give a custom filtering function to
|
||||||
|
-- 'setLastFocusedTopic'.
|
||||||
|
switchTopicWith :: (Topic -> Bool) -> TopicConfig -> Topic -> X ()
|
||||||
|
switchTopicWith predicate tg topic = do
|
||||||
-- Switch to topic and add it to the last seen topics
|
-- Switch to topic and add it to the last seen topics
|
||||||
windows $ W.greedyView topic
|
windows $ W.greedyView topic
|
||||||
setLastFocusedTopic tg topic (const True)
|
setLastFocusedTopic tg topic predicate
|
||||||
|
|
||||||
-- If applicable, execute the topic action
|
-- If applicable, execute the topic action
|
||||||
wins <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
|
wins <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user