mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
add RotView module.
This commit is contained in:
parent
f40cca9e49
commit
95409a005f
30
RotView.hs
Normal file
30
RotView.hs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
module XMonad.RotView ( rotView ) where
|
||||||
|
|
||||||
|
-- To use:
|
||||||
|
-- include XMonad.RotView
|
||||||
|
|
||||||
|
-- , ((modMask .|. shiftMask, xK_Right), rotView True)
|
||||||
|
-- , ((modMask .|. shiftMask, xK_Left), rotView False)
|
||||||
|
|
||||||
|
import qualified Data.Map as M
|
||||||
|
import Control.Monad.State
|
||||||
|
|
||||||
|
import Operations ( view )
|
||||||
|
import XMonad ( X, WorkspaceId, workspace )
|
||||||
|
import StackSet ( StackSet, focus )
|
||||||
|
import qualified StackSet as W ( current )
|
||||||
|
|
||||||
|
rotView :: Bool -> X m ()
|
||||||
|
rotView b = do ws <- gets workspace
|
||||||
|
let m = W.current ws
|
||||||
|
allws = if b then allWorkspaces ws else reverse $ allWorkspaces ws
|
||||||
|
n1 = safehead allws m
|
||||||
|
rot (f:fs) | f == m = safehead fs n1
|
||||||
|
| otherwise = rot fs
|
||||||
|
rot [] = n1
|
||||||
|
safehead fs f = case fs of { [] -> f; f':_ -> f'; }
|
||||||
|
view (rot allws)
|
||||||
|
|
||||||
|
-- | A list of all the workspaces.
|
||||||
|
allWorkspaces :: StackSet WorkspaceId j a -> [WorkspaceId]
|
||||||
|
allWorkspaces = M.keys . focus
|
Loading…
x
Reference in New Issue
Block a user