From 1400d167adaf11813c43ca1047c6f20ee66ac07f Mon Sep 17 00:00:00 2001 From: slotThe Date: Mon, 16 Nov 2020 12:43:07 +0100 Subject: [PATCH] Cons on new topic before filtering the last used topics Because the there is a hard limit on the number of items in the topic history now, it makes sense to first cons on the topic and then filter the result (so setLastFocusedTopic can be used to exclude certain topics from ever entering the history). --- XMonad/Actions/TopicSpace.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XMonad/Actions/TopicSpace.hs b/XMonad/Actions/TopicSpace.hs index 611d2696..b31872c1 100644 --- a/XMonad/Actions/TopicSpace.hs +++ b/XMonad/Actions/TopicSpace.hs @@ -270,14 +270,14 @@ getLastFocusedTopics :: X [String] getLastFocusedTopics = XS.gets getPrevTopics -- | Given a 'TopicConfig', a topic, and a predicate to select topics that one --- wants to keep, this function will filter the list of last focused topics --- according to the predicate and cons the topic in front of that list. Note --- that we prune the list in case its length exceeds 'maxTopicHistory'. +-- wants to keep, this function will cons the topic in front of the list of +-- last focused topics and filter it according to the predicate. Note that we +-- prune the list in case that its length exceeds 'maxTopicHistory'. setLastFocusedTopic :: TopicConfig -> Topic -> (Topic -> Bool) -> X () setLastFocusedTopic tc w predicate = XS.modify $ PrevTopics . take (maxTopicHistory tc) - . nub . (w :) . filter predicate . getPrevTopics + . nub . filter predicate . (w :) . getPrevTopics -- | Reverse the list of "last focused topics" reverseLastFocusedTopics :: X ()