mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
add type information for IndependentScreens
This commit is contained in:
parent
efc2f1160f
commit
cf07f9caca
@ -1,23 +1,31 @@
|
|||||||
-----------------------------------------------------------------------------
|
|
||||||
-- |
|
|
||||||
-- Module : XMonad.Layout.IndependentScreens
|
|
||||||
-- Copyright : (c) 2009 Daniel Wagner
|
|
||||||
-- License : BSD3
|
|
||||||
--
|
|
||||||
-- Maintainer : <daniel@wagner-home.com>
|
|
||||||
-- Stability : unstable
|
|
||||||
-- Portability : unportable
|
|
||||||
--
|
|
||||||
-- Utility functions for simulating independent sets of workspaces on
|
|
||||||
-- each screen (like dwm's workspace model), using internal tags to
|
|
||||||
-- distinguish workspaces associated with each screen.
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
module IndependentScreens where
|
module IndependentScreens where
|
||||||
|
|
||||||
marshall (S sc) ws = show sc ++ '_':ws
|
-- for the screen stuff
|
||||||
|
import Control.Arrow hiding ((|||))
|
||||||
|
import Control.Monad
|
||||||
|
import Control.Monad.Instances
|
||||||
|
import Data.List
|
||||||
|
import Graphics.X11.Xinerama
|
||||||
|
import XMonad
|
||||||
|
import XMonad.StackSet hiding (workspaces)
|
||||||
|
|
||||||
|
type VirtualWorkspace = String
|
||||||
|
type PhysicalWorkspace = String
|
||||||
|
|
||||||
|
marshall :: ScreenId -> VirtualWorkspace -> PhysicalWorkspace
|
||||||
|
marshall (S sc) vws = show sc ++ '_':vws
|
||||||
|
|
||||||
|
unmarshall :: PhysicalWorkspace -> (ScreenId, VirtualWorkspace)
|
||||||
unmarshall = ((S . read) *** drop 1) . break (=='_')
|
unmarshall = ((S . read) *** drop 1) . break (=='_')
|
||||||
|
|
||||||
|
workspaces' :: XConfig l -> [VirtualWorkspace]
|
||||||
workspaces' = nub . map (snd . unmarshall) . workspaces
|
workspaces' = nub . map (snd . unmarshall) . workspaces
|
||||||
withScreens n workspaces = [marshall sc ws | ws <- workspaces, sc <- [0..n-1]]
|
|
||||||
onScreen f workspace = screen . current >>= f . flip marshall workspace
|
withScreens :: ScreenId -> [VirtualWorkspace] -> [PhysicalWorkspace]
|
||||||
countScreens = fmap genericLength $ openDisplay "" >>= getScreenInfo
|
withScreens n vws = [marshall sc pws | pws <- vws, sc <- [0..n-1]]
|
||||||
|
|
||||||
|
onScreen :: (VirtualWorkspace -> WindowSet -> a) -> (PhysicalWorkspace -> WindowSet -> a)
|
||||||
|
onScreen f vws = screen . current >>= f . flip marshall vws
|
||||||
|
|
||||||
|
countScreens :: (MonadIO m, Integral i) => m i
|
||||||
|
countScreens = liftM genericLength . liftIO $ openDisplay "" >>= getScreenInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user