Merge pull request #670 from rdiaz02/withWorkspace-fuzzyMatch

X.A.DynamicWorkspaces.withWorkspace: honor custom search predicate
This commit is contained in:
Tony Zorman
2021-12-28 14:04:07 +01:00
committed by GitHub
2 changed files with 5 additions and 6 deletions

View File

@@ -850,6 +850,9 @@
- Fixed a system freeze when using `X.A.CopyWindow.copy` in
combination with `removeWorkspace`.
- `withWorkspace` now honors the users `searchPredicate`, for
example `fuzzyMatch` from `Prompt.FuzzyMatch`.
## 0.16
### Breaking Changes

View File

@@ -38,7 +38,7 @@ import XMonad.Prelude (find, isNothing, nub, when)
import XMonad hiding (workspaces)
import XMonad.StackSet hiding (filter, modify, delete)
import XMonad.Prompt.Workspace ( Wor(Wor), workspacePrompt )
import XMonad.Prompt ( XPConfig, mkXPrompt )
import XMonad.Prompt ( XPConfig, mkComplFunFromList', mkXPrompt )
import XMonad.Util.WorkspaceCompare ( getSortByIndex )
import qualified Data.Map.Strict as Map
import qualified XMonad.Util.ExtensibleState as XS
@@ -107,17 +107,13 @@ withWorkspaceIndex job widx = do
ilookup :: WorkspaceIndex -> X (Maybe WorkspaceTag)
ilookup idx = Map.lookup idx <$> XS.gets workspaceIndexMap
mkCompl :: [String] -> String -> IO [String]
mkCompl l s = return $ filter (\x -> take (length s) x == s) l
withWorkspace :: XPConfig -> (String -> X ()) -> X ()
withWorkspace c job = do ws <- gets (workspaces . windowset)
sort <- getSortByIndex
let ts = map tag $ sort ws
job' t | t `elem` ts = job t
| otherwise = addHiddenWorkspace t >> job t
mkXPrompt (Wor "") c (mkCompl ts) job'
mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job'
renameWorkspace :: XPConfig -> X ()
renameWorkspace conf = workspacePrompt conf renameWorkspaceByName