[xmonad] withWorkspace (Actions.DynamicWorkspaces): use fuzzyMatch?

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Sun Dec 26 23:50:37 UTC 2021


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/0a84ad772e21155cfc00458b66ccb79899699689/dotfiles/config/xmonad/xmonad.hs#L788) 



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 at gmail.com
       r.diaz at uam.es

https://ligarto.org/rdiaz


More information about the xmonad mailing list