mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Add switchNthLastFocusedExclude
This may be used to exclude certain topics that one never wants to "switch back" to, even if it was visited (for example, the named scratchpad topic).
This commit is contained in:
parent
d13a26b11e
commit
6b22ce17c7
@ -32,6 +32,7 @@ module XMonad.Actions.TopicSpace
|
|||||||
, currentTopicAction
|
, currentTopicAction
|
||||||
, switchTopic
|
, switchTopic
|
||||||
, switchNthLastFocused
|
, switchNthLastFocused
|
||||||
|
, switchNthLastFocusedExclude
|
||||||
, shiftNthLastFocused
|
, shiftNthLastFocused
|
||||||
, currentTopicDir
|
, currentTopicDir
|
||||||
, checkTopicConfig
|
, checkTopicConfig
|
||||||
@ -283,9 +284,13 @@ switchTopic tg topic = do
|
|||||||
|
|
||||||
-- | Switch to the Nth last focused topic or failback to the 'defaultTopic'.
|
-- | Switch to the Nth last focused topic or failback to the 'defaultTopic'.
|
||||||
switchNthLastFocused :: TopicConfig -> Int -> X ()
|
switchNthLastFocused :: TopicConfig -> Int -> X ()
|
||||||
switchNthLastFocused tg depth = do
|
switchNthLastFocused = switchNthLastFocusedExclude []
|
||||||
lastWs <- getLastFocusedTopics
|
|
||||||
switchTopic tg $ (lastWs ++ repeat (defaultTopic tg)) !! depth
|
-- | Like 'switchNthLastFocused', but also filter out certain topics.
|
||||||
|
switchNthLastFocusedExclude :: [Topic] -> TopicConfig -> Int -> X ()
|
||||||
|
switchNthLastFocusedExclude excludes tc depth = do
|
||||||
|
lastWs <- filter (`notElem` excludes) <$> getLastFocusedTopics
|
||||||
|
switchTopic tc $ (lastWs ++ repeat (defaultTopic tc)) !! depth
|
||||||
|
|
||||||
-- | Shift the focused window to the Nth last focused topic, or fallback to doing nothing.
|
-- | Shift the focused window to the Nth last focused topic, or fallback to doing nothing.
|
||||||
shiftNthLastFocused :: Int -> X ()
|
shiftNthLastFocused :: Int -> X ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user