aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/DeManage.hs
blob: 557fa4380322faefc3d2ad84386aa36857e53c93 (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
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Actions.DeManage
-- Copyright   :  (c) Spencer Janssen <spencerjanssen@gmail.com>
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  Spencer Janssen <spencerjanssen@gmail.com>
-- Stability   :  unstable
-- Portability :  unportable
--
-- This module provides a method to cease management of a window
-- without unmapping it.  This is especially useful for applications
-- like kicker and gnome-panel.
--
-- To make a panel display correctly with xmonad:
--
--  * Determine the pixel size of the panel, add that value to
--    'XMonad.Core.XConfig.defaultGaps'
--
--  * Launch the panel
--
--  * Give the panel window focus, then press @mod-d@ (or whatever key
--    you have bound 'demanage' to)
--
--  * Convince the panel to move\/resize to the correct location.  Changing the
--  panel's position setting several times seems to work.
--
-----------------------------------------------------------------------------

module XMonad.Actions.DeManage (
                                 -- * Usage
                                 -- $usage
                                 demanage
                                ) where

import qualified XMonad.StackSet as W
import XMonad

-- $usage
-- To use demanage, add this import to your @~\/.xmonad\/xmonad.hs@:
--
-- >     import XMonad.Actions.DeManage
--
-- And add a keybinding, such as:
--
-- > , ((modMask x,               xK_d     ), withFocused demanage)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".

-- | Stop managing the currently focused window.
demanage :: Window -> X ()
demanage w = do
    -- use modify to defeat automatic 'unmanage' calls.
    modify (\s -> s { windowset = W.delete w (windowset s) })
    refresh