aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/NoBorders.hs
blob: 5aa2fa2bfcaa07e8707d5db1d9f4f4ac953c4ff5 (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
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Actions.NoBorders
-- Copyright   :  (c) Lukas Mai
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  Lukas Mai <l.mai@web.de>
-- Stability   :  stable
-- Portability :  unportable
--
-- This module provides helper functions for dealing with window borders.
--
-----------------------------------------------------------------------------

module XMonad.Actions.NoBorders (
    toggleBorder
) where

import XMonad

-- | Toggle the border of the currently focused window. To use it, add a
-- keybinding like so:
--
-- > , ((modm,  xK_g ),   withFocused toggleBorder)
--
toggleBorder :: Window -> X ()
toggleBorder w = do
    bw <- asks (borderWidth . config)
    withDisplay $ \d -> io $ do
        cw <- wa_border_width `fmap` getWindowAttributes d w
        if cw == 0
            then setWindowBorderWidth d w bw
            else setWindowBorderWidth d w 0