X.L.Renamed: Provide "named" convenience alias

I believe this common use-case for the deprecated X.L.Named should still
be provided somewhere, rather than telling everybody to let-define this
themselves.

The other one – `nameTail` – only has about 6 uses in publicly available
configs (https://github.com/search?q=nameTail+path%3Axmonad&type=code),
so I'm not adding that one but I'm happy to be convinced to add it too.

Related: 3bf9d80c40 ("XMonad.Layout.Named: Deprecate")
This commit is contained in:
Tomas Janousek
2023-12-17 17:37:42 +00:00
parent e75eb16a93
commit 92a7c030b2
3 changed files with 7 additions and 5 deletions

View File

@@ -68,7 +68,8 @@
* `XMonad.Layout.Named`
- Deprecated the entire module, use `XMonad.Layout.Renamed` instead.
- Deprecated the entire module, use `XMonad.Layout.Renamed` (which newly
provides `named` for convenience) instead.
* `XMonad.Actions.SinkAll`

View File

@@ -44,10 +44,6 @@ import XMonad.Layout.Renamed
-- Note that this module has been deprecated and may be removed in a future
-- release, please use "XMonad.Layout.Renamed" instead.
-- | (Deprecated) Rename a layout.
named :: String -> l a -> ModifiedLayout Rename l a
named s = renamed [Replace s]
-- | (Deprecated) Remove the first word of the name.
nameTail :: l a -> ModifiedLayout Rename l a
nameTail = renamed [CutWordsLeft 1]

View File

@@ -19,6 +19,7 @@
module XMonad.Layout.Renamed ( -- * Usage
-- $usage
renamed
, named
, Rename(..) ) where
import XMonad
@@ -40,6 +41,10 @@ import XMonad.Layout.LayoutModifier
renamed :: [Rename a] -> l a -> ModifiedLayout Rename l a
renamed = ModifiedLayout . Chain
-- | Rename a layout. (Convenience alias for @renamed [Replace s]@.)
named :: String -> l a -> ModifiedLayout Rename l a
named s = renamed [Replace s]
-- | The available renaming operations
data Rename a = CutLeft Int -- ^ Remove a number of characters from the left
| CutRight Int -- ^ Remove a number of characters from the right