[xmonad] DynamicProjects: creating a new project that partially matches predefined project

Jacek Generowicz haskell.org-lists at my-post-office.net
Fri Nov 1 07:29:03 UTC 2024


Ramon Diaz-Uriarte <rdiaz02 at gmail.com> 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>

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`.


More information about the xmonad mailing list