aboutsummaryrefslogtreecommitdiffstats
path: root/SinkAll.hs
blob: 04794cc88f777c4b6c66f238218d373cb1a9a3b0 (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
-----------------------------------------------------------------------------
-- |
-- Module       : XmonadContrib.SinkAll
-- License      : BSD3-style (see LICENSE)
-- Stability    : unstable
-- Portability  : unportable
--
-- Provides a simple binding that pushes all floating windows on the current
-- workspace back into tiling.
-----------------------------------------------------------------------------

module XMonadContrib.SinkAll (
    -- * Usage
    -- $usage
    sinkAll) where

import Operations
import XMonad
import StackSet

import Graphics.X11.Xlib

-- $usage
-- > import XMonadContrib.SinkAll
-- > keys = [ ((modMask .|. shiftMask, xK_t), sinkAll) ]

-- %import XMonadContrib.SinkAll
-- %keybind , ((modMask .|. shiftMask, xK_t), sinkAll)

sinkAll :: X ()
sinkAll = withAll sink

-- Apply a function to all windows on current workspace.
withAll :: (Window -> WindowSet -> WindowSet) -> X ()
withAll f = windows $ \ws -> let all' = integrate' . stack . workspace . current $ ws
                             in foldr f ws all'