blob: b2476b3c0a34bb425c3a666c86d7f18c7bb4d645 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
-----------------------------------------------------------------------------
-- |
-- 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,
withBorder
) where
import Control.Monad.State ( gets )
import Graphics.X11.Xlib
import XMonad
import Operations ( UnDoLayout(UnDoLayout) )
import qualified StackSet as W
import {-# SOURCE #-} Config (borderWidth)
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.NoBorders
--
-- and modify the defaultLayouts to call noBorders on the layouts you want to lack
-- borders
--
-- > defaultLayouts = [ noBorders full, ... ]
-- %import XMonadContrib.NoBorders
-- %layout -- prepend noBorders to default layouts above to remove their borders, like so:
-- %layout , noBorders full
noBorders :: Layout a -> Layout a
noBorders = withBorder 0
withBorder :: Dimension -> Layout a -> Layout a
withBorder bd l = l { doLayout = \r x -> setborders bd >> doLayout l r x
, modifyLayout = ml }
where ml m | Just UnDoLayout == fromMessage m
= do setborders borderWidth
fmap (withBorder bd) `fmap` (modifyLayout l) m
| otherwise = fmap (withBorder bd) `fmap` (modifyLayout l) m
setborders :: Dimension -> X ()
setborders bw = withDisplay $ \d ->
do ws <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws
|