X.A.WorkspaceNames: Use history for completion in renameWorkspace

This commit is contained in:
Tomas Janousek 2023-08-11 00:08:05 +01:00
parent 348df92b89
commit 6912eca829
2 changed files with 10 additions and 4 deletions

View File

@ -248,6 +248,10 @@
- Added `orIfPrefixed`, a combinator to decide upon an action based
on whether any prefix argument was given.
* `XMonad.Actions.WorkspaceNames`
- Enabled prompt completion (from history) in `renameWorkspace`.
### Other changes
## 0.17.1 (September 3, 2022)

View File

@ -51,7 +51,7 @@ import XMonad.Actions.CycleWS (findWorkspace, WSType(..), Direction1D(..), anyWS
import qualified XMonad.Actions.SwapWorkspaces as Swap
import XMonad.Hooks.StatusBar.PP (PP(..))
import XMonad.Hooks.EwmhDesktops (addEwmhWorkspaceRename)
import XMonad.Prompt (mkXPrompt, XPConfig)
import XMonad.Prompt (mkXPrompt, XPConfig, historyCompletionP)
import XMonad.Prompt.Workspace (Wor(Wor))
import XMonad.Util.WorkspaceCompare (getSortByIndex)
@ -137,9 +137,11 @@ setCurrentWorkspaceName name = do
-- | Prompt for a new name for the current workspace and set it.
renameWorkspace :: XPConfig -> X ()
renameWorkspace conf =
mkXPrompt pr conf (const (return [])) setCurrentWorkspaceName
where pr = Wor "Workspace name: "
renameWorkspace conf = do
completion <- historyCompletionP (prompt ==)
mkXPrompt (Wor prompt) conf completion setCurrentWorkspaceName
where
prompt = "Workspace name: "
-- | See 'XMonad.Actions.SwapWorkspaces.swapTo'. This is the same with names.
swapTo :: Direction1D -> X ()