DynamicProjects: creating a new project that partially matches predefined project

Dear All, I use XMonad.Actions.DynamicProjects. I have a bunch of configured, predefined projects, say one with name "emacs". Now, when I use switchProjectPrompt, I do not know how to create a new (not predefined) project called "em": as soon as I type "em" it matches "emacs" and on pressing enter the "emacs" project is created. The only solution I've found is to type "em1" or similar, to prevent matching but I guess there must be a simpler way that I am missing. Thanks, R. -- 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 ramon.diaz@iib.uam.es https://ligarto.org/rdiaz

This is an interesting issue. I *think* you need to change your XPConfig to
change autoComplete to Nothing so the completion isn't auto-selected. It
would be nice if switchProjectPrompt did this automatically, though.
On Thu, Oct 31, 2024 at 4:09 AM Ramon Diaz-Uriarte
Dear All,
I use XMonad.Actions.DynamicProjects. I have a bunch of configured, predefined projects, say one with name "emacs". Now, when I use switchProjectPrompt, I do not know how to create a new (not predefined) project called "em": as soon as I type "em" it matches "emacs" and on pressing enter the "emacs" project is created. The only solution I've found is to type "em1" or similar, to prevent matching but I guess there must be a simpler way that I am missing.
Thanks,
R.
-- 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 ramon.diaz@iib.uam.es
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- brandon s allbery kf8nh allbery.b@gmail.com

Thanks, but I tried and it does not seem to solve it. These are the relevant bits of my xmonad.hs
myProjectConfig = def {
font = "xft:Inconsolata:size=14:bold:antialias=true"
, position = CenteredAt (1/2) (1/2)
, fgColor = "White"
, bgColor = "#454545"
, height = 36
, searchPredicate = fuzzyMatch
, sorter = fuzzySort
, autoComplete = Nothing
}
("M-w", switchProjectPrompt myProjectConfig)
I've commented out the fuzzyMatch and fuzzSort , but that does not help.
Best,
R.
On Thu, 31-October-2024, at 16:45:49, Brandon Allbery
This is an interesting issue. I think you need to change your XPConfig to change autoComplete to Nothing so the completion isn't auto-selected. It would be nice if switchProjectPrompt did this automatically, though.
On Thu, Oct 31, 2024 at 4:09 AM Ramon Diaz-Uriarte
wrote: Dear All,
I use XMonad.Actions.DynamicProjects. I have a bunch of configured, predefined projects, say one with name "emacs". Now, when I use switchProjectPrompt, I do not know how to create a new (not predefined) project called "em": as soon as I type "em" it matches "emacs" and on pressing enter the "emacs" project is created. The only solution I've found is to type "em1" or similar, to prevent matching but I guess there must be a simpler way that I am missing.
Thanks,
R.
-- 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 ramon.diaz@iib.uam.es
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- 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 ramon.diaz@iib.uam.es https://ligarto.org/rdiaz

Ramon Diaz-Uriarte
I use XMonad.Actions.DynamicProjects.
I do not, but I do use XMonad.Actions.DynamicWorkspaces ...
Now, when I use switchProjectPrompt, I do not know how to create a new (not predefined) project called "em": as soon as I type "em" it matches "emacs" and on pressing enter the "emacs" project is created.
... which has similar issues. I'll try to find and describe the "official" solution I have in my config, below, but in practice I don't use it, because I hack around the problem with the following trick: 1. start the new dynamic namespace name with an underscore 2. type exactly the new name you want after the underscore 3. C-a to the beginning and delete the underscore 4. <RET> Now for the official solution, lemme see ... the relevant bits are something like gotoWorkspace = selectWorkspace myXPConfig makeWorkspace = selectWorkspace myXPConfig { autoComplete = Nothing } which I have bound to two different keys, with the latter not suffering from the problem you describe. selectWorkspace` is imported from XMonad.Actions.DynamicWorkspaces, so I guess it's equivalent to `switchProjectPrompt`. `myXPConfig` starts with myXPConfig = def { -- If only one completion remains, auto-select it after 1 -- microsecond. Increasing the delay could help to stop accidentally -- sending keypresses to the newly focused window, but with my -- current usage, 1 microsecond is working just fine. autoComplete = Just 1 and I now recall playing around with increasing the delay as an alternative solution, and not liking it. Git tells me that I created `makeWorkspace` & friends over 12 years ago, but, in practice, I've been using the underscore hack ever since, because, on the rare occasions that I need it, it's easier to remember the hack than the keybinding of `makeWorkspace`.

Thanks! Your practical solution works. Actually, it works with what is, for me, an even simpler trick.
On Fri, 01-November-2024, at 08:29:03, Jacek Generowicz
Ramon Diaz-Uriarte
writes: I use XMonad.Actions.DynamicProjects.
I do not, but I do use XMonad.Actions.DynamicWorkspaces ...
Now, when I use switchProjectPrompt, I do not know how to create a new (not predefined) project called "em": as soon as I type "em" it matches "emacs" and on pressing enter the "emacs" project is created.
... which has similar issues.
I'll try to find and describe the "official" solution I have in my config, below, but in practice I don't use it, because I hack around the problem with the following trick:
1. start the new dynamic namespace name with an underscore 2. type exactly the new name you want after the underscore 3. C-a to the beginning and delete the underscore 4. <RET>
1. start the new dynamic namespace name 2. type exactly the new name you want and add, at end, any one character that prevents the match 3. delete the last character 4. <RET> It never occurred to me to try this until I read your approach! So the difference with respect to your procedure is that I do not start with an underscore, but prevent the match at the very end; this has two benefits for me: a) I do not need to C-a to the beginning; b) I can decide, or realize, while typing that there is/there is not a matching name, so sometimes I do not need to add anything since there is no matching name.
Now for the official solution, lemme see ... the relevant bits are something like
gotoWorkspace = selectWorkspace myXPConfig makeWorkspace = selectWorkspace myXPConfig { autoComplete = Nothing }
which I have bound to two different keys, with the latter not suffering from the problem you describe.
selectWorkspace` is imported from XMonad.Actions.DynamicWorkspaces, so I guess it's equivalent to `switchProjectPrompt`.
`myXPConfig` starts with
myXPConfig = def { -- If only one completion remains, auto-select it after 1 -- microsecond. Increasing the delay could help to stop accidentally -- sending keypresses to the newly focused window, but with my -- current usage, 1 microsecond is working just fine. autoComplete = Just 1
and I now recall playing around with increasing the delay as an alternative solution, and not liking it.
In myXPConfig for DynamicProjects I can comment out the "autoComplete = Nothing" (or leave it as Nothing). And this is the setting that I like best (I did not like using other delays). If I am understanding correctly, by setting "autoComplete = Nothing" I can break the match by adding something, and that broken match is not rematched when I delete the last char. If I were to use "autoComplete = Just 1" (or any other delay) I'd need to start with the underscore, as otherwise I'd be taken (after the delay) to a matching project.
Git tells me that I created `makeWorkspace` & friends over 12 years ago, but, in practice, I've been using the underscore hack ever since, because, on the rare occasions that I need it, it's easier to remember the hack than the keybinding of `makeWorkspace`.
The trick will be very easy for me to use (and I end up being in this situation often). Best, R. -- 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 ramon.diaz@iib.uam.es https://ligarto.org/rdiaz
participants (3)
-
Brandon Allbery
-
Jacek Generowicz
-
Ramon Diaz-Uriarte