mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-28 18:51:51 -07:00
This is a convenience module in order to have less import noise. It re-exports the following: a) Commonly used modules in full (Data.Foldable, Data.Applicative, and so on); though only those that play nicely with each other, so that XMonad.Prelude can be imported unqualified without any problems. This prevents things like `Prelude.(.)` and `Control.Category.(.)` fighting with each other. b) Helper functions that don't necessarily fit in any other module; e.g., the often used abbreviation `fi = fromIntegral`.
52 lines
1.6 KiB
Haskell
52 lines
1.6 KiB
Haskell
-----------------------------------------------------------------------------
|
|
-- |
|
|
-- 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 XMonad.Prelude hiding (foldr)
|
|
|
|
import XMonad
|
|
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:
|
|
--
|
|
-- , ((modm .|. 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 |