patch: Add search string to X.A.GridSelect grid

I find it very convenient to be able to use GridSelect to choose an option that isn't in the original list of options. One of the uses of this is to switch to a dynamic workspace that doesn't yet exist.

Any GridSelect users want to try this out and verify it doesn't break anything before I push it? -- gwern http://www.gwern.net

On Wed, Jan 16, 2013 at 2:54 PM, Gwern Branwen
Any GridSelect users want to try this out and verify it doesn't break anything before I push it?
The patch works well, but I think it would be better to have: gs_searchConverter :: String -> Maybe a rather than `Maybe (String -> a)'. This way you could express things like: don't show an option to create a workspace with name "", or don't show an option to create a workspace with a name identical to a workspace which already existed. Further generalization like: `gs_searchConverter :: String -> [(String, a)]' or even `gs_searchConverter :: String -> X [(String, a)]' might be useful for getting completions from the shell. If that happens, XMonad.Actions.GridSelect will get closer to XMonad.Prompt in terms of features. Regards, Adam

On 1/16/13, adam vogt
The patch works well, but I think it would be better to have:
gs_searchConverter :: String -> Maybe a
rather than `Maybe (String -> a)'. This way you could express things like: don't show an option to create a workspace with name "", or don't show an option to create a workspace with a name identical to a workspace which already existed.
Further generalization like: `gs_searchConverter :: String -> [(String, a)]' or even `gs_searchConverter :: String -> X [(String, a)]' might be useful for getting completions from the shell. If that happens, XMonad.Actions.GridSelect will get closer to XMonad.Prompt in terms of features.
Attached is a more elaborate patch bundle than before. It fixes an existing FIXME along the way, and generalizes my original idea as suggested. It's less obvious what's going on now, but I hope the added documentation is sufficiently clear. As far as using GridSelect and Prompt for launching things, don't the following already perform essentially the same function? Or did you have something else in mind? import XMonad (io, spawn, whenJust) import XMonad.Actions.GridSelect (defaultGSConfig, gridselect) import XMonad.Prompt (defaultXPConfig) import XMonad.Prompt.Shell (getCommands, shellPrompt) -- (1) do cmds <- io getCommands g <- gridselect defaultGSConfig $ zip cmds cmds whenJust g spawn -- (2) shellPrompt defaultXPConfig

On 23/01/2013, Dmitri Iouchtchenko
On 1/16/13, adam vogt
wrote: The patch works well, but I think it would be better to have: ...
Attached is a more elaborate patch bundle than before. It fixes an ...
For reference, the old message of mine that I'm replying to (with the attached bundle) is archived at https://www.haskell.org/pipermail/xmonad/2013-January/013467.html. Are there any objections to the last version of the changes? The bundle is almost two years old now, which means that I've been using the code for that long without any issues. There's been one patch since then that affects the same file, but a cursory glance didn't reveal any conflicts.
participants (3)
-
adam vogt
-
Dmitri Iouchtchenko
-
Gwern Branwen