diff options
Diffstat (limited to 'XMonad/Actions')
-rw-r--r-- | XMonad/Actions/DynamicWorkspaceOrder.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/XMonad/Actions/DynamicWorkspaceOrder.hs b/XMonad/Actions/DynamicWorkspaceOrder.hs index 04ddcf5..75f16ee 100644 --- a/XMonad/Actions/DynamicWorkspaceOrder.hs +++ b/XMonad/Actions/DynamicWorkspaceOrder.hs @@ -28,6 +28,8 @@ module XMonad.Actions.DynamicWorkspaceOrder , moveToGreedy , shiftTo + , withNthWorkspace + ) where import XMonad @@ -162,4 +164,15 @@ moveToGreedy dir t = doTo dir t getSortByOrder (windows . W.greedyView) -- | Shift the currently focused window to the next workspace of the -- given type in the given direction, using the dynamic workspace order. shiftTo :: Direction1D -> WSType -> X () -shiftTo dir t = doTo dir t getSortByOrder (windows . W.shift)
\ No newline at end of file +shiftTo dir t = doTo dir t getSortByOrder (windows . W.shift) + +-- | Do something with the nth workspace in the dynamic order. The +-- callback is given the workspace's tag as well as the @WindowSet@ +-- of the workspace itself. +withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X () +withNthWorkspace job wnum = do + sort <- getSortByOrder + ws <- gets (map W.tag . sort . W.workspaces . windowset) + case drop wnum ws of + (w:_) -> windows $ job w + [] -> return ()
\ No newline at end of file |