Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Silently capture completion options



I am trying to set up voice control software (talon with a wav2letter
backend) to work well with shell completion.  I would like to be able to
capture what the results of a completion *would* be if it ran, but
without the normal showing of results.  The goal is to be able to feed
the completions into the voice command software so that the next spoken
word can be chosen from the available completion options.  The nature of
the talon/wav2letter combination seems to require that you have a
wordlist first and the audio is used to guess which word was most likely
matched.

So then the challenge is how to expose the current completion options
from a zsh prompt.  The only prior art I could find was this hack on
github:

    https://github.com/Valodim/zsh-capture-completion

But that's not particularly useful to me.

I could imagine two high-level ways of doing it:

- A "push" strategy where after every keystroke the completion code is
  updated, a la https://github.com/marlonrichert/zsh-autocomplete.  Only
  in this case the results would be written to a file named after the
  WINDOWID (this is all under X11).  After that, watching for file
  updates and tracking the focused window and notifying talon
  accordingly is easy.

- A "pull" strategy where some callable function or widget can return
  the results of a completion (without altering the prompt of course).
  That function/widget could be triggered by trapping a signal or by
  reading a packet from a socket or something.  After that, I would be
  able to hook the rest of the system together I believe.

I'm pretty new to trying to hack zsh.  I spent a bunch of time trying to
read docs and make things work but I still don't really have any idea of
what I want is possible (or how much coding it would take to become
possible).

Does anybody have any ideas or pointers for how to do this sort of
thing?




Messages sorted by: Reverse Date, Date, Thread, Author