aboutsummaryrefslogtreecommitdiffstats
path: root/NoBorders.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
commit4866f2e367dfcf22a9591231ba40948826a1b438 (patch)
tree7a245caee3f146826b267d773b7eaa80386a818e /NoBorders.hs
parent47589e1913fb9530481caedb543978a30d4323ea (diff)
downloadXMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.gz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.xz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.zip
Hierarchify
darcs-hash:20071101201059-a5988-fc1f1262bec1b69e13ba18ae7cefeafc8c4471d4.gz
Diffstat (limited to 'NoBorders.hs')
-rw-r--r--NoBorders.hs106
1 files changed, 0 insertions, 106 deletions
diff --git a/NoBorders.hs b/NoBorders.hs
deleted file mode 100644
index a1fdc96..0000000
--- a/NoBorders.hs
+++ /dev/null
@@ -1,106 +0,0 @@
-{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}
-
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.NoBorders
--- Copyright : (c) David Roundy <droundy@darcs.net>
--- License : BSD3-style (see LICENSE)
---
--- Maintainer : David Roundy <droundy@darcs.net>
--- Stability : unstable
--- Portability : unportable
---
--- Make a given layout display without borders. This is useful for
--- full-screen or tabbed layouts, where you don't really want to waste a
--- couple of pixels of real estate just to inform yourself that the visible
--- window has focus.
---
------------------------------------------------------------------------------
-
-module XMonadContrib.NoBorders (
- -- * Usage
- -- $usage
- noBorders,
- smartBorders,
- withBorder
- ) where
-
-import Control.Monad.State (gets)
-import Control.Monad.Reader (asks)
-import Graphics.X11.Xlib
-
-import XMonad
-import XMonadContrib.LayoutModifier
-import qualified XMonad.StackSet as W
-import Data.List ((\\))
-
--- $usage
--- You can use this module with the following in your Config.hs file:
---
--- > import XMonadContrib.NoBorders
---
--- and modify the layouts to call noBorders on the layouts you want to lack
--- borders
---
--- > layouts = [ Layout (noBorders Full), ... ]
---
-
--- %import XMonadContrib.NoBorders
--- %layout -- prepend noBorders to default layouts above to remove their borders, like so:
--- %layout , noBorders Full
-
--- todo, use an InvisibleList.
-data WithBorder a = WithBorder Dimension [a] deriving ( Read, Show )
-
-instance LayoutModifier WithBorder Window where
- modifierDescription (WithBorder 0 _) = "NoBorders"
- modifierDescription (WithBorder n _) = "Borders " ++ show n
-
- unhook (WithBorder _ s) = asks (borderWidth . config) >>= setBorders s
-
- redoLayout (WithBorder n s) _ _ wrs = do
- asks (borderWidth . config) >>= setBorders (s \\ ws)
- setBorders ws n
- return (wrs, Just $ WithBorder n ws)
- where
- ws = map fst wrs
-
-noBorders :: LayoutClass l Window => l Window -> ModifiedLayout WithBorder l Window
-noBorders = ModifiedLayout $ WithBorder 0 []
-
-withBorder :: LayoutClass l a => Dimension -> l a -> ModifiedLayout WithBorder l a
-withBorder b = ModifiedLayout $ WithBorder b []
-
-setBorders :: [Window] -> Dimension -> X ()
-setBorders ws bw = withDisplay $ \d -> mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws
-
-data SmartBorder a = SmartBorder [a] deriving (Read, Show)
-
-instance LayoutModifier SmartBorder Window where
- modifierDescription _ = "SmartBorder"
-
- unhook (SmartBorder s) = asks (borderWidth . config) >>= setBorders s
-
- redoLayout (SmartBorder s) _ _ wrs = do
- ss <- gets (W.screens . windowset)
-
- if singleton ws && singleton ss
- then do
- asks (borderWidth . config) >>= setBorders (s \\ ws)
- setBorders ws 0
- return (wrs, Just $ SmartBorder ws)
- else do
- asks (borderWidth . config) >>= setBorders s
- return (wrs, Just $ SmartBorder [])
- where
- ws = map fst wrs
- singleton = null . drop 1
-
---
--- | You can cleverly set no borders on a range of layouts, using a
--- layoutHook like so:
---
--- > layoutHook = Layout $ smartBorders $ Select layouts
---
-smartBorders :: LayoutClass l a => l a -> ModifiedLayout SmartBorder l a
-smartBorders = ModifiedLayout (SmartBorder [])