mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 04:31:52 -07:00
move XMonad.Actions.SinkAll functionality to more general XMonad.Actions.WithAll, and re-export sinkAll from X.A.SinkAll for backwards compatibility
This commit is contained in:
@@ -5,48 +5,17 @@
|
||||
-- Stability : unstable
|
||||
-- Portability : unportable
|
||||
--
|
||||
-- Provides a simple binding that pushes all floating windows on the current
|
||||
-- workspace back into tiling.
|
||||
-- Provides a simple binding that pushes all floating windows on the
|
||||
-- current workspace back into tiling. Note that the functionality of
|
||||
-- this module has been folded into the more general
|
||||
-- "XMonad.Actions.WithAll"; this module simply re-exports the
|
||||
-- 'sinkAll' function for backwards compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module XMonad.Actions.SinkAll (
|
||||
-- * Usage
|
||||
-- $usage
|
||||
sinkAll, withAll,
|
||||
withAll', killAll) where
|
||||
|
||||
import Data.Foldable hiding (foldr)
|
||||
sinkAll) where
|
||||
|
||||
import XMonad
|
||||
import XMonad.Core
|
||||
import XMonad.Operations
|
||||
import XMonad.StackSet
|
||||
|
||||
-- $usage
|
||||
--
|
||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||
--
|
||||
-- > import XMonad.Actions.SinkAll
|
||||
--
|
||||
-- then add a keybinding; for example:
|
||||
--
|
||||
-- , ((modMask x .|. shiftMask, xK_t), sinkAll)
|
||||
--
|
||||
-- For detailed instructions on editing your key bindings, see
|
||||
-- "XMonad.Doc.Extending#Editing_key_bindings".
|
||||
|
||||
-- | Un-float all floating windows on the current workspace.
|
||||
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'
|
||||
|
||||
withAll :: (Window -> X ()) -> X()
|
||||
withAll f = withWindowSet $ \ws -> let all' = integrate' . stack . workspace . current $ ws
|
||||
in forM_ all' f
|
||||
|
||||
killAll :: X()
|
||||
killAll = withAll killWindow
|
||||
import XMonad.Actions.WithAll (sinkAll)
|
||||
|
54
XMonad/Actions/WithAll.hs
Normal file
54
XMonad/Actions/WithAll.hs
Normal file
@@ -0,0 +1,54 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-- |
|
||||
-- Module : XMonad.Actions.WithAll
|
||||
-- License : BSD3-style (see LICENSE)
|
||||
-- Stability : unstable
|
||||
-- Portability : unportable
|
||||
--
|
||||
-- Provides functions for performing a given action on all windows of
|
||||
-- the current workspace.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module XMonad.Actions.WithAll (
|
||||
-- * Usage
|
||||
-- $usage
|
||||
sinkAll, withAll,
|
||||
withAll', killAll) where
|
||||
|
||||
import Data.Foldable hiding (foldr)
|
||||
|
||||
import XMonad
|
||||
import XMonad.Core
|
||||
import XMonad.Operations
|
||||
import XMonad.StackSet
|
||||
|
||||
-- $usage
|
||||
--
|
||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||
--
|
||||
-- > import XMonad.Actions.WithAll
|
||||
--
|
||||
-- then add a keybinding; for example:
|
||||
--
|
||||
-- , ((modMask x .|. shiftMask, xK_t), sinkAll)
|
||||
--
|
||||
-- For detailed instructions on editing your key bindings, see
|
||||
-- "XMonad.Doc.Extending#Editing_key_bindings".
|
||||
|
||||
-- | Un-float all floating windows on the current workspace.
|
||||
sinkAll :: X ()
|
||||
sinkAll = withAll' sink
|
||||
|
||||
-- | Apply a function to all windows on the current workspace.
|
||||
withAll' :: (Window -> WindowSet -> WindowSet) -> X ()
|
||||
withAll' f = windows $ \ws -> let all' = integrate' . stack . workspace . current $ ws
|
||||
in foldr f ws all'
|
||||
|
||||
-- | Execute an 'X' action for each window on the current workspace.
|
||||
withAll :: (Window -> X ()) -> X()
|
||||
withAll f = withWindowSet $ \ws -> let all' = integrate' . stack . workspace . current $ ws
|
||||
in forM_ all' f
|
||||
|
||||
-- | Kill all the windows on the current workspace.
|
||||
killAll :: X()
|
||||
killAll = withAll killWindow
|
@@ -105,6 +105,7 @@ library
|
||||
XMonad.Actions.WindowNavigation
|
||||
XMonad.Actions.WindowGo
|
||||
XMonad.Actions.WindowBringer
|
||||
XMonad.Actions.WithAll
|
||||
XMonad.Config.Arossato
|
||||
XMonad.Config.Azerty
|
||||
XMonad.Config.Desktop
|
||||
|
Reference in New Issue
Block a user