mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Make RotView compile.
As I'm not a Xinerama user, I'm not sure if rotView should consider only hidden workspaces or also visible but not focused workspaces. I thought hidden workspaces only would be more logical.
This commit is contained in:
parent
585a01aecf
commit
4b7c97d96b
38
RotView.hs
38
RotView.hs
@ -8,28 +8,24 @@ module XMonadContrib.RotView ( rotView ) where
|
|||||||
-- , ((modMask .|. shiftMask, xK_Right), rotView True)
|
-- , ((modMask .|. shiftMask, xK_Right), rotView True)
|
||||||
-- , ((modMask .|. shiftMask, xK_Left), rotView False)
|
-- , ((modMask .|. shiftMask, xK_Left), rotView False)
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import Control.Monad.State ( gets )
|
||||||
import Control.Monad.State
|
import Data.List ( sortBy )
|
||||||
|
|
||||||
import Operations ( view )
|
|
||||||
import XMonad ( X, WorkspaceId, workspace, whenJust )
|
|
||||||
import StackSet ( StackSet )
|
|
||||||
import Data.Maybe ( listToMaybe )
|
import Data.Maybe ( listToMaybe )
|
||||||
import qualified StackSet as W ( stacks, current, visibleWorkspaces, index )
|
|
||||||
|
import XMonad
|
||||||
|
import StackSet
|
||||||
|
import qualified Operations as O
|
||||||
|
|
||||||
rotView :: Bool -> X ()
|
rotView :: Bool -> X ()
|
||||||
rotView b = do ws <- gets windowset
|
rotView b = do
|
||||||
let m = W.current ws
|
ws <- gets windowset
|
||||||
vis = W.visibleWorkspaces ws
|
let m = tag . workspace . current $ ws
|
||||||
allws = if b then allWorkspaces ws else reverse $ allWorkspaces ws
|
sortWs = sortBy (\x y -> compare (tag x) (tag y))
|
||||||
pivoted = uncurry (flip (++)) . span (/=m) $ allws
|
pivoted = uncurry (flip (++)) . span ((< m) . tag) . sortWs . hidden $ ws
|
||||||
interesting i = not (i `elem` vis) && not (isEmpty i ws)
|
nextws = listToMaybe . filter (not.isEmpty) . (if b then id else reverse) $ pivoted
|
||||||
nextws = listToMaybe . filter interesting $ pivoted
|
whenJust nextws (O.view . tag)
|
||||||
whenJust nextws view
|
|
||||||
|
|
||||||
-- | A list of all the workspaces.
|
isEmpty :: Workspace i a -> Bool
|
||||||
allWorkspaces :: StackSet WorkspaceId j a -> [WorkspaceId]
|
isEmpty ws = case stack ws of
|
||||||
allWorkspaces = M.keys . W.stacks
|
Empty -> True
|
||||||
|
_ -> False
|
||||||
isEmpty :: WorkspaceId -> StackSet WorkspaceId j a -> Bool
|
|
||||||
isEmpty i = maybe True null . W.index i
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user