From 20737092d502b9d08634093465382efd7a15f98a Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 17 Sep 2015 12:00:09 +0200 Subject: Do not switch to default config if depth is out of range --- xmonad.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xmonad.hs b/xmonad.hs index 7f1373c..080a036 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -60,7 +60,7 @@ import XMonad.Util.Replace (replace) import Control.Monad (when) import System.Environment (getArgs) -import Data.Maybe (fromMaybe, fromJust, isNothing, isJust, mapMaybe) +import Data.Maybe (fromMaybe, fromJust, isNothing, isJust, mapMaybe, listToMaybe) import Data.Ord (comparing) -- for hostname handling (no windows key on "Australien") @@ -531,6 +531,13 @@ myKeys c hostname = "Australien" -> "M-S-q" _ -> "M-M5-q" + -- Like X.A.TopicSpace.switchNthLastFocused but defaults to do nothing + -- if depth is too big and not to switch to the default topic. + switchNthLastFocused :: TopicConfig -> Int -> X () + switchNthLastFocused tg depth = do + ws <- fmap (listToMaybe . drop depth) getLastFocusedTopics + whenJust ws $ switchTopic tg + myMouse modm c = [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> snapMagicMove (Just 50) (Just 50) w)) -- cgit v1.2.3