X.A.WithAll: Add killOthers

This adds the function `killOthers`, which kills all unfocused windows
on the current workspace.

As discussed in the PR itself [1], the module suffix `WithAll` is not
quite optimal at this point, as we are acting on window _groups_ and not
necessarily just all window on a workspace.  However, in order to keep
this commit atomic, this consideration is postponed until another day.

[1]: https://github.com/xmonad/xmonad-contrib/pull/602
This commit is contained in:
Solomon Bothwell 2021-09-16 13:02:37 -07:00 committed by slotThe
parent 0c6fdf4e75
commit 7a2001cfa2
3 changed files with 15 additions and 5 deletions

View File

@ -302,6 +302,11 @@
* Add support for GHC 9.0.1. * Add support for GHC 9.0.1.
* `XMonad.Actions.WithAll`
- Added `killOthers`, which kills all unfocused windows on the
current workspace.
* `XMonad.Prompt.XMonad` * `XMonad.Prompt.XMonad`
- Added `xmonadPromptCT`, which allows you to create an XMonad - Added `xmonadPromptCT`, which allows you to create an XMonad

View File

@ -5,15 +5,16 @@
-- Stability : unstable -- Stability : unstable
-- Portability : unportable -- Portability : unportable
-- --
-- Provides functions for performing a given action on all windows of -- Provides functions for performing a given action on all or certain
-- the current workspace. -- groups of windows on the current workspace.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
module XMonad.Actions.WithAll ( module XMonad.Actions.WithAll (
-- * Usage -- * Usage
-- $usage -- $usage
sinkAll, withAll, sinkAll, withAll,
withAll', killAll) where withAll', killAll,
killOthers) where
import XMonad.Prelude hiding (foldr) import XMonad.Prelude hiding (foldr)
@ -50,3 +51,7 @@ withAll f = withWindowSet $ \ws -> let all' = integrate' . stack . workspace . c
-- | Kill all the windows on the current workspace. -- | Kill all the windows on the current workspace.
killAll :: X() killAll :: X()
killAll = withAll killWindow killAll = withAll killWindow
-- | Kill all the unfocused windows on the current workspace.
killOthers :: X ()
killOthers = withUnfocused killWindow

View File

@ -336,8 +336,8 @@ edit your key bindings.
Experimental rewrite of "XMonad.Layout.WindowNavigation". Experimental rewrite of "XMonad.Layout.WindowNavigation".
* "XMonad.Actions.WithAll": * "XMonad.Actions.WithAll":
Provides functions for performing a given action on all windows of Provides functions for performing a given action on all or certain
the current workspace. groups of windows on the current workspace.
* "XMonad.Actions.Workscreen": * "XMonad.Actions.Workscreen":
A workscreen permits to display a set of workspaces on several screens. In A workscreen permits to display a set of workspaces on several screens. In