aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/TopicSpace.hs
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2009-06-23 02:26:45 +0200
committerAdam Vogt <vogt.adam@gmail.com>2009-06-23 02:26:45 +0200
commit4f23e3daecdacf4703b59dbc7838c0e1810373b2 (patch)
tree032f240e398a4c9f467d0e3808e18e2a826798f6 /XMonad/Actions/TopicSpace.hs
parentccd89e7fc99f9609b2cd7770930cf1cc6e35f6f2 (diff)
downloadXMonadContrib-4f23e3daecdacf4703b59dbc7838c0e1810373b2.tar.gz
XMonadContrib-4f23e3daecdacf4703b59dbc7838c0e1810373b2.tar.xz
XMonadContrib-4f23e3daecdacf4703b59dbc7838c0e1810373b2.zip
Add shiftNthLastFocused to A.TopicSpace
Ignore-this: 64f4fa63f4cc25f634f8fbc3276ef2a2 darcs-hash:20090623002645-1499c-6f88accec5c461121b01175a5687b0672d1eafa1.gz
Diffstat (limited to 'XMonad/Actions/TopicSpace.hs')
-rw-r--r--XMonad/Actions/TopicSpace.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/XMonad/Actions/TopicSpace.hs b/XMonad/Actions/TopicSpace.hs
index 547d143..bb9bd24 100644
--- a/XMonad/Actions/TopicSpace.hs
+++ b/XMonad/Actions/TopicSpace.hs
@@ -159,6 +159,7 @@ module XMonad.Actions.TopicSpace
, currentTopicAction
, switchTopic
, switchNthLastFocused
+ , shiftNthLastFocused
, currentTopicDir
, checkTopicConfig
, (>*>)
@@ -168,7 +169,7 @@ where
import XMonad
import Data.List
-import Data.Maybe (fromMaybe, isNothing)
+import Data.Maybe (fromMaybe, isNothing, listToMaybe)
import Data.Ord
import qualified Data.Map as M
import Graphics.X11.Xlib
@@ -274,6 +275,12 @@ switchNthLastFocused tg depth = do
lastWs <- getLastFocusedTopics
switchTopic tg $ (lastWs ++ repeat (defaultTopic tg)) !! depth
+-- | Shift the focused window to the Nth last focused topic, or fallback to doing nothing.
+shiftNthLastFocused :: Int -> X ()
+shiftNthLastFocused n = do
+ ws <- fmap (listToMaybe . drop n) getLastFocusedTopics
+ whenJust ws $ windows . W.shift
+
-- | Returns the directory associated with current topic returns the empty string otherwise.
currentTopicDir :: TopicConfig -> X String
currentTopicDir tg = do