diff options
author | David Roundy <droundy@darcs.net> | 2008-05-16 20:57:29 +0200 |
---|---|---|
committer | David Roundy <droundy@darcs.net> | 2008-05-16 20:57:29 +0200 |
commit | e8820d14d08798aebc64487e99180a0089f2d543 (patch) | |
tree | c7b955ededa8864cc1c5980558ae85ebb6e42dd1 | |
parent | d55ab1c5218fff41c29fd639fae86958cc8ef325 (diff) | |
download | XMonadContrib-e8820d14d08798aebc64487e99180a0089f2d543.tar.gz XMonadContrib-e8820d14d08798aebc64487e99180a0089f2d543.tar.xz XMonadContrib-e8820d14d08798aebc64487e99180a0089f2d543.zip |
remove ScratchWorkspace.
It's ugly code, and I'd be surprised if anyone actually uses it. I see no
reason to continue to maintain it.
darcs-hash:20080516185729-72aca-86bf61fa5bd42dcff023fde72cfa49e9b322037a.gz
-rw-r--r-- | XMonad/Layout/ScratchWorkspace.hs | 95 | ||||
-rw-r--r-- | xmonad-contrib.cabal | 1 |
2 files changed, 0 insertions, 96 deletions
diff --git a/XMonad/Layout/ScratchWorkspace.hs b/XMonad/Layout/ScratchWorkspace.hs deleted file mode 100644 index 56febeb..0000000 --- a/XMonad/Layout/ScratchWorkspace.hs +++ /dev/null @@ -1,95 +0,0 @@ -{-# OPTIONS -fglasgow-exts #-} ------------------------------------------------------------------------------ --- | --- Module : XMonad.Layout.ScratchWorkspace --- Copyright : (c) Braden Shepherdson, David Roundy 2008 --- License : BSD-style (as xmonad) --- --- Maintainer : Braden.Shepherdson@gmail.com --- Stability : unstable --- Portability : unportable - -module XMonad.Layout.ScratchWorkspace ( toggleScratchWorkspace ) where - -import Data.List ( partition ) -import Control.Monad ( guard ) - -import XMonad -import XMonad.Core -import qualified XMonad.StackSet as W - -hiddenRect :: Rectangle -hiddenRect = Rectangle (-1) (-1) 0 0 - -scratchName :: String -scratchName = "*scratch*" - --- This module uses an ugly hack, which is to create a special screen for --- the scratch workspace. This screen is then moved onto a visible area or --- away when you ask for the scratch workspace to be shown or hidden. - --- This is a workaround for the fact that we don't have anything like --- proper support for hierarchical workspaces, so I use the only hierarchy --- we've got, which is at the screen level. - -toggleScratchWorkspace :: LayoutClass l Int => l Int -> X () -toggleScratchWorkspace l = - do s <- gets windowset - defaultl <- asks (layoutHook . config) - srs <- withDisplay getCleanedScreenInfo - if length srs == 1 + length (W.visible s) - then -- we don't yet have a scratch screen! - if scratchName `W.tagMember` s - then return () -- We'll just bail out of scratchName already exists... - else do let scratchscreen = W.Screen scratch (-1) (SD hiddenRect) - scratch = W.Workspace scratchName defaultl Nothing - s' = s { W.visible = scratchscreen: W.visible s } - modify $ \st -> st { windowset = s' } - refresh - else -- We've already got a scratch (we think) - if length srs /= length (W.visible s) - then -- Something is odd... too many screens are visible! Do nothing. - return () - else -- Yes, it does seem there's a scratch screen already - case partition ((/= -1) . W.screen) $ W.current s : W.visible s of - (others@(c:vs),[scratchscreen]) -> - if screenRect (W.screenDetail scratchscreen) == hiddenRect - then -- we're hidden now, so let's display ourselves - do let r = screenRect $ W.screenDetail c - (rs,_) <- runLayout (W.Workspace "" l (Just $ W.Stack 0 [1] [])) r - let (r0, r1) = case rs of - [(0,ra),(1,rb)] -> (ra,rb) - [(1,ra),(0,rb)] -> (rb,ra) - [(1,ra)] -> (r,ra) - [(0,ra)] -> (ra,r) - _ -> (r,r) - s' = s { W.current = setrect r0 scratchscreen, - W.visible = setrect r1 c : vs } - modify $ \st -> st { windowset = s' } - refresh - else -- we're visible, so now we want to hide - do ml <- handleMessage (W.layout $ W.workspace scratchscreen) (SomeMessage Hide) - let scratchscreen' = case ml of - Nothing -> scratchscreen - Just l' -> scratchscreen - { W.workspace = - (W.workspace scratchscreen) { W.layout = l' } } - mapM_ hide $ W.integrate' $ W.stack $ W.workspace scratchscreen - let modscr scr = do guard $ scratchName /= W.tag (W.workspace scr) - r' <- pickRect (W.screen scr) srs - Just $ setrect r' scr - pickRect _ [z] = Just z - pickRect i (z:zs) | i < 1 = Just z - | otherwise = pickRect (i-1) zs - pickRect _ [] = Nothing - case mapM modscr others of - Just (c':vs') -> - do let s' = s { W.current = c', - W.visible = setrect hiddenRect scratchscreen' : vs' } - modify $ \st -> st { windowset = s' } - refresh - _ -> return () -- weird error! - _ -> -- Something is odd... there doesn't seem to *really* be a scratch screen... - return () - where setrect :: Rectangle -> W.Screen i l a sid ScreenDetail -> W.Screen i l a sid ScreenDetail - setrect x scr = scr {W.screenDetail = (W.screenDetail scr) {screenRect = x}} diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index fa815d4..44c6a62 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -147,7 +147,6 @@ library XMonad.Layout.ResizableTile XMonad.Layout.ResizeScreen XMonad.Layout.Roledex - XMonad.Layout.ScratchWorkspace XMonad.Layout.Simplest XMonad.Layout.SimpleDecoration XMonad.Layout.SimpleFloat |