diff options
Diffstat (limited to 'src/Rahm/Desktop/StackSet.hs')
| -rw-r--r-- | src/Rahm/Desktop/StackSet.hs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Rahm/Desktop/StackSet.hs b/src/Rahm/Desktop/StackSet.hs index 251bee3..8db16c1 100644 --- a/src/Rahm/Desktop/StackSet.hs +++ b/src/Rahm/Desktop/StackSet.hs @@ -5,10 +5,12 @@ module Rahm.Desktop.StackSet ( swapWorkspaces, greedyView, shiftWin, + screenRotateBackward, + screenRotateForward, module W) where -import Prelude hiding (head, tail) -import Data.List.Safe (head, tail) +import Prelude hiding (head) +import Data.List.Safe (head) import Data.List (find) import XMonad.StackSet as W hiding (greedyView, shiftWin) import qualified XMonad.StackSet @@ -49,3 +51,19 @@ greedyView wid ss = swapWorkspaces (tag . workspace . current $ ss) wid ss shiftWin :: (Ord a, Eq s, Eq i) => i -> a -> StackSet i l a s sd -> StackSet i l a s sd shiftWin wid a = XMonad.StackSet.shiftWin wid a . fst . ensureWorkspace wid + +screenRotateBackward :: W.StackSet i l a sid sd -> W.StackSet i l a sid sd +screenRotateBackward (W.StackSet current visible others floating) = do + let screens = current : visible + workspaces = tail $ cycle $ map W.workspace screens + (current':visible') = zipWith (\s w -> s {workspace = w} ) screens workspaces + in W.StackSet current' visible' others floating + +screenRotateForward :: W.StackSet i l a sid sd -> W.StackSet i l a sid sd +screenRotateForward (W.StackSet current visible others floating) = do + let screens = current : visible + workspaces = rcycle $ map W.workspace screens + (current':visible') = zipWith (\s w -> s {workspace = w} ) screens workspaces + in W.StackSet current' visible' others floating + + where rcycle l = last l : l |