aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/SinkAll.hs
diff options
context:
space:
mode:
Diffstat (limited to 'XMonad/Actions/SinkAll.hs')
-rw-r--r--XMonad/Actions/SinkAll.hs36
1 files changed, 36 insertions, 0 deletions
diff --git a/XMonad/Actions/SinkAll.hs b/XMonad/Actions/SinkAll.hs
new file mode 100644
index 0000000..c193ad0
--- /dev/null
+++ b/XMonad/Actions/SinkAll.hs
@@ -0,0 +1,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 XMonad.Actions.SinkAll (
+ -- * Usage
+ -- $usage
+ sinkAll) where
+
+import XMonad.Operations
+import XMonad
+import XMonad.StackSet
+
+import Graphics.X11.Xlib
+
+-- $usage
+-- > import XMonad.Actions.SinkAll
+-- > keys = [ ((modMask .|. shiftMask, xK_t), sinkAll) ]
+
+-- %import XMonad.Actions.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'