{-# LANGUAGE LambdaCase #-}
module XMonad.Layout.IndependentScreens (
VirtualWorkspace, PhysicalWorkspace,
VirtualWindowSpace, PhysicalWindowSpace,
workspaces',
withScreen, withScreens,
onCurrentScreen,
marshallPP,
whenCurrentOn,
countScreens,
workspacesOn,
workspaceOnScreen, focusWindow', focusScreen, nthWorkspace, withWspOnScreen,
marshall, unmarshall, unmarshallS, unmarshallW,
marshallWindowSpace, unmarshallWindowSpace, marshallSort,
) where
import Control.Arrow ((***))
import Graphics.X11.Xinerama
import XMonad
import XMonad.Hooks.StatusBar.PP
import XMonad.Prelude
import qualified XMonad.StackSet as W
type VirtualWorkspace = WorkspaceId
type PhysicalWorkspace = WorkspaceId
type PhysicalWindowSpace = WindowSpace
type VirtualWindowSpace = WindowSpace
marshall :: ScreenId -> VirtualWorkspace -> PhysicalWorkspace
marshall :: ScreenId -> PhysicalWorkspace -> PhysicalWorkspace
marshall (S Int
sc) PhysicalWorkspace
vws = Int -> PhysicalWorkspace
forall a. Show a => a -> PhysicalWorkspace
show Int
sc PhysicalWorkspace -> PhysicalWorkspace -> PhysicalWorkspace
forall a. [a] -> [a] -> [a]
++ Char
'_'Char -> PhysicalWorkspace -> PhysicalWorkspace
forall a. a -> [a] -> [a]
:PhysicalWorkspace
vws
unmarshall :: PhysicalWorkspace -> (ScreenId, VirtualWorkspace)
unmarshallS :: PhysicalWorkspace -> ScreenId
unmarshallW :: PhysicalWorkspace -> VirtualWorkspace
unmarshall :: PhysicalWorkspace -> (ScreenId, PhysicalWorkspace)
unmarshall = ((Int -> ScreenId
S (Int -> ScreenId)
-> (PhysicalWorkspace -> Int) -> PhysicalWorkspace -> ScreenId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PhysicalWorkspace -> Int
forall a. Read a => PhysicalWorkspace -> a
read) (PhysicalWorkspace -> ScreenId)
-> (PhysicalWorkspace -> PhysicalWorkspace)
-> (PhysicalWorkspace, PhysicalWorkspace)
-> (ScreenId, PhysicalWorkspace)
forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** Int -> PhysicalWorkspace -> PhysicalWorkspace
forall a. Int -> [a] -> [a]
drop Int
1) ((PhysicalWorkspace, PhysicalWorkspace)
-> (ScreenId, PhysicalWorkspace))
-> (PhysicalWorkspace -> (PhysicalWorkspace, PhysicalWorkspace))
-> PhysicalWorkspace
-> (ScreenId, PhysicalWorkspace)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool)
-> PhysicalWorkspace -> (PhysicalWorkspace, PhysicalWorkspace)
forall a. (a -> Bool) -> [a] -> ([a], [a])
break (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
==Char
'_')
unmarshallS :: PhysicalWorkspace -> ScreenId
unmarshallS = (ScreenId, PhysicalWorkspace) -> ScreenId
forall a b. (a, b) -> a
fst ((ScreenId, PhysicalWorkspace) -> ScreenId)
-> (PhysicalWorkspace -> (ScreenId, PhysicalWorkspace))
-> PhysicalWorkspace
-> ScreenId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PhysicalWorkspace -> (ScreenId, PhysicalWorkspace)
unmarshall
unmarshallW :: PhysicalWorkspace -> PhysicalWorkspace
unmarshallW = (ScreenId, PhysicalWorkspace) -> PhysicalWorkspace
forall a b. (a, b) -> b
snd ((ScreenId, PhysicalWorkspace) -> PhysicalWorkspace)
-> (PhysicalWorkspace -> (ScreenId, PhysicalWorkspace))
-> PhysicalWorkspace
-> PhysicalWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PhysicalWorkspace -> (ScreenId, PhysicalWorkspace)
unmarshall
workspaces' :: XConfig l -> [VirtualWorkspace]
workspaces' :: forall (l :: * -> *). XConfig l -> [PhysicalWorkspace]
workspaces' = [PhysicalWorkspace] -> [PhysicalWorkspace]
forall a. Eq a => [a] -> [a]
nub ([PhysicalWorkspace] -> [PhysicalWorkspace])
-> (XConfig l -> [PhysicalWorkspace])
-> XConfig l
-> [PhysicalWorkspace]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PhysicalWorkspace -> PhysicalWorkspace)
-> [PhysicalWorkspace] -> [PhysicalWorkspace]
forall a b. (a -> b) -> [a] -> [b]
map PhysicalWorkspace -> PhysicalWorkspace
unmarshallW ([PhysicalWorkspace] -> [PhysicalWorkspace])
-> (XConfig l -> [PhysicalWorkspace])
-> XConfig l
-> [PhysicalWorkspace]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XConfig l -> [PhysicalWorkspace]
forall (l :: * -> *). XConfig l -> [PhysicalWorkspace]
workspaces
withScreen :: ScreenId
-> [VirtualWorkspace]
-> [PhysicalWorkspace]
withScreen :: ScreenId -> [PhysicalWorkspace] -> [PhysicalWorkspace]
withScreen ScreenId
n = (PhysicalWorkspace -> PhysicalWorkspace)
-> [PhysicalWorkspace] -> [PhysicalWorkspace]
forall a b. (a -> b) -> [a] -> [b]
map (ScreenId -> PhysicalWorkspace -> PhysicalWorkspace
marshall ScreenId
n)
withScreens :: ScreenId
-> [VirtualWorkspace]
-> [PhysicalWorkspace]
withScreens :: ScreenId -> [PhysicalWorkspace] -> [PhysicalWorkspace]
withScreens ScreenId
n [PhysicalWorkspace]
vws = (ScreenId -> [PhysicalWorkspace])
-> [ScreenId] -> [PhysicalWorkspace]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (ScreenId -> [PhysicalWorkspace] -> [PhysicalWorkspace]
`withScreen` [PhysicalWorkspace]
vws) [ScreenId
0..ScreenId
nScreenId -> ScreenId -> ScreenId
forall a. Num a => a -> a -> a
-ScreenId
1]
onCurrentScreen :: (PhysicalWorkspace -> WindowSet -> a) -> (VirtualWorkspace -> WindowSet -> a)
onCurrentScreen :: forall a.
(PhysicalWorkspace -> WindowSet -> a)
-> PhysicalWorkspace -> WindowSet -> a
onCurrentScreen PhysicalWorkspace -> WindowSet -> a
f PhysicalWorkspace
vws WindowSet
ws =
let currentScreenId :: ScreenId
currentScreenId = Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> ScreenId
forall i l a sid sd. Screen i l a sid sd -> sid
W.screen (Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> ScreenId)
-> Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> ScreenId
forall a b. (a -> b) -> a -> b
$ WindowSet
-> Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
W.current WindowSet
ws
in PhysicalWorkspace -> WindowSet -> a
f (ScreenId -> PhysicalWorkspace -> PhysicalWorkspace
marshall ScreenId
currentScreenId PhysicalWorkspace
vws) WindowSet
ws
workspaceOnScreen :: ScreenId -> WindowSet -> Maybe PhysicalWorkspace
workspaceOnScreen :: ScreenId -> WindowSet -> Maybe PhysicalWorkspace
workspaceOnScreen ScreenId
screenId WindowSet
ws = Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall i l a. Workspace i l a -> i
W.tag (Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace)
-> (Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> Workspace PhysicalWorkspace (Layout Window) Window)
-> Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> PhysicalWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> Workspace PhysicalWorkspace (Layout Window) Window
forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
W.workspace (Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> PhysicalWorkspace)
-> Maybe
(Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail)
-> Maybe PhysicalWorkspace
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ScreenId
-> WindowSet
-> Maybe
(Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail)
screenOnMonitor ScreenId
screenId WindowSet
ws
withWspOnScreen :: ScreenId
-> (PhysicalWorkspace -> WindowSet -> WindowSet)
-> WindowSet -> WindowSet
withWspOnScreen :: ScreenId
-> (PhysicalWorkspace -> WindowSet -> WindowSet)
-> WindowSet
-> WindowSet
withWspOnScreen ScreenId
screenId PhysicalWorkspace -> WindowSet -> WindowSet
operation WindowSet
ws = case ScreenId -> WindowSet -> Maybe PhysicalWorkspace
workspaceOnScreen ScreenId
screenId WindowSet
ws of
Just PhysicalWorkspace
wsp -> PhysicalWorkspace -> WindowSet -> WindowSet
operation PhysicalWorkspace
wsp WindowSet
ws
Maybe PhysicalWorkspace
Nothing -> WindowSet
ws
screenOnMonitor :: ScreenId -> WindowSet -> Maybe WindowScreen
screenOnMonitor :: ScreenId
-> WindowSet
-> Maybe
(Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail)
screenOnMonitor ScreenId
screenId WindowSet
ws = (Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> Bool)
-> [Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail]
-> Maybe
(Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail)
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find ((ScreenId
screenId ScreenId -> ScreenId -> Bool
forall a. Eq a => a -> a -> Bool
==) (ScreenId -> Bool)
-> (Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> ScreenId)
-> Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> ScreenId
forall i l a sid sd. Screen i l a sid sd -> sid
W.screen) (WindowSet
-> Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
W.current WindowSet
ws Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail
-> [Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail]
-> [Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail]
forall a. a -> [a] -> [a]
: WindowSet
-> [Screen
PhysicalWorkspace (Layout Window) Window ScreenId ScreenDetail]
forall i l a sid sd. StackSet i l a sid sd -> [Screen i l a sid sd]
W.visible WindowSet
ws)
focusWindow' :: Window -> WindowSet -> WindowSet
focusWindow' :: Window -> WindowSet -> WindowSet
focusWindow' Window
window WindowSet
ws
| Window -> Maybe Window
forall a. a -> Maybe a
Just Window
window Maybe Window -> Maybe Window -> Bool
forall a. Eq a => a -> a -> Bool
== WindowSet -> Maybe Window
forall i l a s sd. StackSet i l a s sd -> Maybe a
W.peek WindowSet
ws = WindowSet
ws
| Bool
otherwise = case Window -> WindowSet -> Maybe PhysicalWorkspace
forall a i l s sd. Eq a => a -> StackSet i l a s sd -> Maybe i
W.findTag Window
window WindowSet
ws of
Just PhysicalWorkspace
tag -> Window -> WindowSet -> WindowSet
forall s a i l sd.
(Eq s, Eq a, Eq i) =>
a -> StackSet i l a s sd -> StackSet i l a s sd
W.focusWindow Window
window (WindowSet -> WindowSet) -> WindowSet -> WindowSet
forall a b. (a -> b) -> a -> b
$ ScreenId -> WindowSet -> WindowSet
focusScreen (PhysicalWorkspace -> ScreenId
unmarshallS PhysicalWorkspace
tag) WindowSet
ws
Maybe PhysicalWorkspace
Nothing -> WindowSet
ws
focusScreen :: ScreenId -> WindowSet -> WindowSet
focusScreen :: ScreenId -> WindowSet -> WindowSet
focusScreen ScreenId
screenId = ScreenId
-> (PhysicalWorkspace -> WindowSet -> WindowSet)
-> WindowSet
-> WindowSet
withWspOnScreen ScreenId
screenId PhysicalWorkspace -> WindowSet -> WindowSet
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view
nthWorkspace :: Int -> X (Maybe VirtualWorkspace)
nthWorkspace :: Int -> X (Maybe PhysicalWorkspace)
nthWorkspace Int
n = ([PhysicalWorkspace] -> Int -> Maybe PhysicalWorkspace
forall a. [a] -> Int -> Maybe a
!? Int
n) ([PhysicalWorkspace] -> Maybe PhysicalWorkspace)
-> (XConfig Layout -> [PhysicalWorkspace])
-> XConfig Layout
-> Maybe PhysicalWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XConfig Layout -> [PhysicalWorkspace]
forall (l :: * -> *). XConfig l -> [PhysicalWorkspace]
workspaces' (XConfig Layout -> Maybe PhysicalWorkspace)
-> X (XConfig Layout) -> X (Maybe PhysicalWorkspace)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (XConf -> XConfig Layout) -> X (XConfig Layout)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks XConf -> XConfig Layout
config
countScreens :: (MonadIO m, Integral i) => m i
countScreens :: forall (m :: * -> *) i. (MonadIO m, Integral i) => m i
countScreens = ([Rectangle] -> i) -> m [Rectangle] -> m i
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Rectangle] -> i
forall i a. Num i => [a] -> i
genericLength (m [Rectangle] -> m i)
-> (IO [Rectangle] -> m [Rectangle]) -> IO [Rectangle] -> m i
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO [Rectangle] -> m [Rectangle]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Rectangle] -> m i) -> IO [Rectangle] -> m i
forall a b. (a -> b) -> a -> b
$ PhysicalWorkspace -> IO Display
openDisplay PhysicalWorkspace
"" IO Display -> (Display -> IO [Rectangle]) -> IO [Rectangle]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (IO [Rectangle] -> IO () -> IO [Rectangle])
-> (Display -> IO [Rectangle])
-> (Display -> IO ())
-> Display
-> IO [Rectangle]
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 IO [Rectangle] -> IO () -> IO [Rectangle]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
(<*) Display -> IO [Rectangle]
getScreenInfo Display -> IO ()
closeDisplay
marshallPP :: ScreenId -> PP -> PP
marshallPP :: ScreenId -> PP -> PP
marshallPP ScreenId
s PP
pp = PP
pp { ppRename :: PhysicalWorkspace
-> Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
ppRename = PP
-> PhysicalWorkspace
-> Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
ppRename PP
pp (PhysicalWorkspace
-> Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace)
-> (PhysicalWorkspace -> PhysicalWorkspace)
-> PhysicalWorkspace
-> Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PhysicalWorkspace -> PhysicalWorkspace
unmarshallW
, ppSort :: X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
ppSort = (([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScreenId
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
workspacesOn ScreenId
s) (([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> PP
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
ppSort PP
pp }
whenCurrentOn :: ScreenId -> PP -> PP
whenCurrentOn :: ScreenId -> PP -> PP
whenCurrentOn ScreenId
s PP
pp = PP
pp
{ ppSort :: X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
ppSort = do
[Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
sorter <- PP
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
ppSort PP
pp
([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]))
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> X ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
forall a b. (a -> b) -> a -> b
$ \case xs :: [Workspace PhysicalWorkspace (Layout Window) Window]
xs@(Workspace PhysicalWorkspace (Layout Window) Window
x:[Workspace PhysicalWorkspace (Layout Window) Window]
_) | PhysicalWorkspace -> ScreenId
unmarshallS (Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall i l a. Workspace i l a -> i
W.tag Workspace PhysicalWorkspace (Layout Window) Window
x) ScreenId -> ScreenId -> Bool
forall a. Eq a => a -> a -> Bool
== ScreenId
s -> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
sorter [Workspace PhysicalWorkspace (Layout Window) Window]
xs
[Workspace PhysicalWorkspace (Layout Window) Window]
_ -> []
, ppOrder :: [PhysicalWorkspace] -> [PhysicalWorkspace]
ppOrder = \case (PhysicalWorkspace
"":[PhysicalWorkspace]
_) -> [PhysicalWorkspace
"\0"]
[PhysicalWorkspace]
list -> PP -> [PhysicalWorkspace] -> [PhysicalWorkspace]
ppOrder PP
pp [PhysicalWorkspace]
list
, ppOutput :: PhysicalWorkspace -> IO ()
ppOutput = \case PhysicalWorkspace
"\0" -> () -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
PhysicalWorkspace
output -> PP -> PhysicalWorkspace -> IO ()
ppOutput PP
pp PhysicalWorkspace
output
}
workspacesOn :: ScreenId -> [PhysicalWindowSpace] -> [PhysicalWindowSpace]
workspacesOn :: ScreenId
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
workspacesOn ScreenId
s = (Workspace PhysicalWorkspace (Layout Window) Window -> Bool)
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall a. (a -> Bool) -> [a] -> [a]
filter (\Workspace PhysicalWorkspace (Layout Window) Window
ws -> PhysicalWorkspace -> ScreenId
unmarshallS (Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall i l a. Workspace i l a -> i
W.tag Workspace PhysicalWorkspace (Layout Window) Window
ws) ScreenId -> ScreenId -> Bool
forall a. Eq a => a -> a -> Bool
== ScreenId
s)
marshallSort :: ScreenId -> ([VirtualWindowSpace] -> [VirtualWindowSpace]) -> ([PhysicalWindowSpace] -> [PhysicalWindowSpace])
marshallSort :: ScreenId
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
marshallSort ScreenId
s [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
vSort = [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
pScreens ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
vSort ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
vScreens where
vScreens :: [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
vScreens = (Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window)
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall a b. (a -> b) -> [a] -> [b]
map Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window
unmarshallWindowSpace ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> ([Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window])
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScreenId
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
workspacesOn ScreenId
s
pScreens :: [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
pScreens = (Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window)
-> [Workspace PhysicalWorkspace (Layout Window) Window]
-> [Workspace PhysicalWorkspace (Layout Window) Window]
forall a b. (a -> b) -> [a] -> [b]
map (ScreenId
-> Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window
marshallWindowSpace ScreenId
s)
marshallWindowSpace :: ScreenId -> WindowSpace -> WindowSpace
unmarshallWindowSpace :: WindowSpace -> WindowSpace
marshallWindowSpace :: ScreenId
-> Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window
marshallWindowSpace ScreenId
s Workspace PhysicalWorkspace (Layout Window) Window
ws = Workspace PhysicalWorkspace (Layout Window) Window
ws { tag :: PhysicalWorkspace
W.tag = ScreenId -> PhysicalWorkspace -> PhysicalWorkspace
marshall ScreenId
s (Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall i l a. Workspace i l a -> i
W.tag Workspace PhysicalWorkspace (Layout Window) Window
ws) }
unmarshallWindowSpace :: Workspace PhysicalWorkspace (Layout Window) Window
-> Workspace PhysicalWorkspace (Layout Window) Window
unmarshallWindowSpace Workspace PhysicalWorkspace (Layout Window) Window
ws = Workspace PhysicalWorkspace (Layout Window) Window
ws { tag :: PhysicalWorkspace
W.tag = PhysicalWorkspace -> PhysicalWorkspace
unmarshallW (Workspace PhysicalWorkspace (Layout Window) Window
-> PhysicalWorkspace
forall i l a. Workspace i l a -> i
W.tag Workspace PhysicalWorkspace (Layout Window) Window
ws) }