withWorkspace (Actions.DynamicWorkspaces): use fuzzyMatch?

Dear All, Summary: ======== I think withWorkspace, from Actions.DynamicWorkspaces, does not honor fuzzyMatch (Prompt.FuzzyMatch). In contrast, selectWorkspace and renameWorkspace (also from DynamicWorkspaces) do work with fuzzyMatch. workspacePrompt (Prompt.Workspace) and switchProjectPrompt (Actions.DynamicProjects) also work with fuzzyMatch. Details ======== With this in my xmonad.hs mySPcentered = def { searchPredicate = fuzzyMatch , sorter = fuzzySort } the following , ("M-m", withWorkspace mySPcentered (windows . W.shift)) does not use fuzzy matching but , ("M-m", workspacePrompt mySPcentered (windows . W.shift)) does use fuzzy matching. Note that , ("M-a", selectWorkspace mySPcentered) , ("M-s", renameWorkspace mySPcentered) both use fuzzy matching (and both selectWorkspace and renameWorkspace are from DynamicWorkspaces). And note that , ("M-w", switchProjectPrompt myProjectConfig) with switchProjectPrompt from Actions.DynamicProjects, also works with fuzzyMatch. Workaround? =========== Complete Haskell ignorant here, but from looking at the source of withWorkspace (Actions.DynamicWorkspaces) and workspacePrompt (Prompt.Workspace), I wonder if withWorkspace should be written as withWorkspace c job = do ws <- gets (workspaces . windowset) sort <- getSortByIndex let ts = map W.tag $ sort ws job' t | t `elem` ts = job t | otherwise = addHiddenWorkspace t >> job t mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job' I have changed the last line from mkXPrompt (Wor "") c (mkCompl ts) job' to mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job' Using this in my xmonad.hs seems to work fine with windows' shift, copy and shiftThenView (last one from Ivan Malison's https://github.com/ivanmalison/dotfiles/blob/0a84ad772e21155cfc00458b66ccb79...) Best, -- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

Hi, On Mon, Dec 27 2021 00:50, Ramon Diaz-Uriarte wrote:
I have changed the last line from mkXPrompt (Wor "") c (mkCompl ts) job' to mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job'
Using this in my xmonad.hs seems to work fine with windows' shift, copy and shiftThenView (last one from Ivan Malison's https://github.com/ivanmalison/dotfiles/blob/0a84ad772e21155cfc00458b66ccb79...)
Indeed, I think this would be the right change. The current `mkCompl` is basically just what `mkComplFunFromList'` with the default `searchPredicate` (which is `isPrefixOf`) does; it's definitely better to let users choose their own predicate. If you want, you can submit a pull-request for this[1]! Tony [1]: https://github.com/xmonad/xmonad-contrib/compare

On Mon, 27-December-2021, at 08:00:26, Solid
Hi,
On Mon, Dec 27 2021 00:50, Ramon Diaz-Uriarte wrote:
I have changed the last line from mkXPrompt (Wor "") c (mkCompl ts) job' to mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job'
Using this in my xmonad.hs seems to work fine with windows' shift, copy and shiftThenView (last one from Ivan Malison's https://github.com/ivanmalison/dotfiles/blob/0a84ad772e21155cfc00458b66ccb79...)
Indeed, I think this would be the right change. The current `mkCompl` is basically just what `mkComplFunFromList'` with the default `searchPredicate` (which is `isPrefixOf`) does; it's definitely better to let users choose their own predicate.
Thanks for the confirmation!
If you want, you can submit a pull-request for this[1]!
I just did. (Which makes me feel rather uneasy, given my haskell-ignorance ;-) ) Best, R.
Tony
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz
participants (2)
-
Ramon Diaz-Uriarte
-
Solid