mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-06 23:11:54 -07:00
Add shiftNthLastFocused to A.TopicSpace
This commit is contained in:
@@ -159,6 +159,7 @@ module XMonad.Actions.TopicSpace
|
|||||||
, currentTopicAction
|
, currentTopicAction
|
||||||
, switchTopic
|
, switchTopic
|
||||||
, switchNthLastFocused
|
, switchNthLastFocused
|
||||||
|
, shiftNthLastFocused
|
||||||
, currentTopicDir
|
, currentTopicDir
|
||||||
, checkTopicConfig
|
, checkTopicConfig
|
||||||
, (>*>)
|
, (>*>)
|
||||||
@@ -168,7 +169,7 @@ where
|
|||||||
import XMonad
|
import XMonad
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe (fromMaybe, isNothing)
|
import Data.Maybe (fromMaybe, isNothing, listToMaybe)
|
||||||
import Data.Ord
|
import Data.Ord
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Graphics.X11.Xlib
|
import Graphics.X11.Xlib
|
||||||
@@ -274,6 +275,12 @@ switchNthLastFocused tg depth = do
|
|||||||
lastWs <- getLastFocusedTopics
|
lastWs <- getLastFocusedTopics
|
||||||
switchTopic tg $ (lastWs ++ repeat (defaultTopic tg)) !! depth
|
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.
|
-- | Returns the directory associated with current topic returns the empty string otherwise.
|
||||||
currentTopicDir :: TopicConfig -> X String
|
currentTopicDir :: TopicConfig -> X String
|
||||||
currentTopicDir tg = do
|
currentTopicDir tg = do
|
||||||
|
Reference in New Issue
Block a user