1
0
mirror of https://github.com/xmonad/xmonad-contrib.git synced 2025-07-29 11:11:52 -07:00

Consistent indentation throughout the module

Two spaces seem to be a bit more common here, hence it was chosen over four
spaces.
This commit is contained in:
slotThe
2020-11-16 10:54:51 +01:00
parent 3c1866979d
commit 4c0b5330e7

@@ -253,17 +253,17 @@ data TopicConfig = TopicConfig { topicDirs :: M.Map Topic Dir
} }
instance Default TopicConfig where instance Default TopicConfig where
def = TopicConfig { topicDirs = M.empty def = TopicConfig { topicDirs = M.empty
, topicActions = M.empty , topicActions = M.empty
, defaultTopicAction = const (ask >>= spawn . terminal . config) , defaultTopicAction = const (ask >>= spawn . terminal . config)
, defaultTopic = "1" , defaultTopic = "1"
, maxTopicHistory = 10 , maxTopicHistory = 10
} }
newtype PrevTopics = PrevTopics { getPrevTopics :: [String] } deriving (Read,Show,Typeable) newtype PrevTopics = PrevTopics { getPrevTopics :: [String] } deriving (Read,Show,Typeable)
instance ExtensionClass PrevTopics where instance ExtensionClass PrevTopics where
initialValue = PrevTopics [] initialValue = PrevTopics []
extensionType = PersistentExtension extensionType = PersistentExtension
-- | Return the (possibly empty) list of last focused topics. -- | Return the (possibly empty) list of last focused topics.
getLastFocusedTopics :: X [String] getLastFocusedTopics :: X [String]
@@ -289,18 +289,18 @@ reverseLastFocusedTopics =
-- and highlight topics with urgent windows. -- and highlight topics with urgent windows.
pprWindowSet :: TopicConfig -> PP -> X String pprWindowSet :: TopicConfig -> PP -> X String
pprWindowSet tg pp = do pprWindowSet tg pp = do
winset <- gets windowset winset <- gets windowset
urgents <- readUrgents urgents <- readUrgents
let empty_workspaces = map W.tag $ filter (isNothing . W.stack) $ W.workspaces winset let empty_workspaces = map W.tag $ filter (isNothing . W.stack) $ W.workspaces winset
maxDepth = maxTopicHistory tg maxDepth = maxTopicHistory tg
setLastFocusedTopic (W.tag . W.workspace . W.current $ winset) setLastFocusedTopic (W.tag . W.workspace . W.current $ winset)
(`notElem` empty_workspaces) (`notElem` empty_workspaces)
lastWs <- getLastFocusedTopics lastWs <- getLastFocusedTopics
let depth topic = fromJust $ elemIndex topic (lastWs ++ [topic]) let depth topic = fromJust $ elemIndex topic (lastWs ++ [topic])
add_depth proj topic = proj pp . (((topic++":")++) . show) . depth $ topic add_depth proj topic = proj pp . (((topic++":")++) . show) . depth $ topic
pp' = pp { ppHidden = add_depth ppHidden, ppVisible = add_depth ppVisible } pp' = pp { ppHidden = add_depth ppHidden, ppVisible = add_depth ppVisible }
sortWindows = take maxDepth . sortBy (comparing $ depth . W.tag) sortWindows = take maxDepth . sortBy (comparing $ depth . W.tag)
return $ DL.pprWindowSet sortWindows urgents pp' winset return $ DL.pprWindowSet sortWindows urgents pp' winset
-- | Given a prompt configuration and a topic configuration, trigger the action associated with -- | Given a prompt configuration and a topic configuration, trigger the action associated with
-- the topic given in prompt. -- the topic given in prompt.
@@ -352,16 +352,16 @@ currentTopicDir tg = do
-- | Check the given topic configuration for duplicate or undefined topics. -- | Check the given topic configuration for duplicate or undefined topics.
checkTopicConfig :: [Topic] -> TopicConfig -> IO () checkTopicConfig :: [Topic] -> TopicConfig -> IO ()
checkTopicConfig tags tg = do checkTopicConfig tags tg = do
-- tags <- gets $ map W.tag . workspaces . windowset -- tags <- gets $ map W.tag . workspaces . windowset
let let
seenTopics = nub $ sort $ M.keys (topicDirs tg) ++ M.keys (topicActions tg) seenTopics = nub $ sort $ M.keys (topicDirs tg) ++ M.keys (topicActions tg)
dups = tags \\ nub tags dups = tags \\ nub tags
diffTopic = seenTopics \\ sort tags diffTopic = seenTopics \\ sort tags
check lst msg = unless (null lst) $ xmessage $ msg ++ " (tags): " ++ show lst check lst msg = unless (null lst) $ xmessage $ msg ++ " (tags): " ++ show lst
check diffTopic "Seen but missing topics/workspaces" check diffTopic "Seen but missing topics/workspaces"
check dups "Duplicate topics/workspaces" check dups "Duplicate topics/workspaces"
-- | Display the given message using the @xmessage@ program. -- | Display the given message using the @xmessage@ program.
xmessage :: String -> IO () xmessage :: String -> IO ()