From 6b16737f1e93f88348a90debb27379aa27811fbc Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 19 Jun 2011 14:51:29 +0200 Subject: [PATCH] xmonad.hs: Fix endless loop in nextLayoutIncluding. --- xmonad.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xmonad.hs b/xmonad.hs index 395d449..d4c323a 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -108,16 +108,17 @@ nextLayoutIncluding :: [String] -> X () nextLayoutIncluding layouts = do cws <- gets (W.workspace . W.current . windowset) sendMessageWithNoRefresh NextLayout cws - nextLayoutIncluding' layouts + nextLayoutIncluding' layouts 1000 -- nobody has more than 1000 layouts -nextLayoutIncluding' :: [String] -> X () -nextLayoutIncluding' layouts = do +nextLayoutIncluding' :: [String] -> Int -> X () +nextLayoutIncluding' layouts iterations = do cws <- gets (W.workspace . W.current . windowset) - if not $ (description $ W.layout cws) `elem` layouts + -- iterations prevents an endless loop if no valid layout can be found. + if not ((description $ W.layout cws) `elem` layouts) && iterations > 0 -- Skip over excluded layouts. then do sendMessageWithNoRefresh NextLayout cws - nextLayoutIncluding' layouts + nextLayoutIncluding' layouts (iterations - 1) -- Found allowed layout, show it. else refresh -- 2.45.2