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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Iouchtchenko
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GridSelect-search-string.dpatch
Type: application/octet-stream
Size: 4567 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130112/13c4ac62/attachment.obj>

Reply | Threaded
Open this post in threaded view
|

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

Gwern Branwen
Any GridSelect users want to try this out and verify it doesn't break
anything before I push it?

--
gwern
http://www.gwern.net


Reply | Threaded
Open this post in threaded view
|

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

Adam Vogt
On Wed, Jan 16, 2013 at 2:54 PM, Gwern Branwen <gwern0 at gmail.com> wrote:
> 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


Reply | Threaded
Open this post in threaded view
|

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

Dmitri Iouchtchenko
On 1/16/13, adam vogt <vogt.adam at gmail.com> wrote:

> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GridSelect-rearrangers.dpatch
Type: application/octet-stream
Size: 15871 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130123/8ab55b3a/attachment-0001.obj>

Reply | Threaded
Open this post in threaded view
|

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

Dmitri Iouchtchenko
On 23/01/2013, Dmitri Iouchtchenko <johnnyspoon at gmail.com> wrote:
> On 1/16/13, adam vogt <vogt.adam at gmail.com> 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.