zsh-workers
 help / color / mirror / code / Atom feed
From: Ryan Beethe <ryan@splintermail.com>
To: zsh-workers@zsh.org
Subject: Silently capture completion options
Date: Wed, 30 Dec 2020 15:52:03 -0700	[thread overview]
Message-ID: <X+0Ek88baOQNCWiT@archenemy.localdomain> (raw)
In-Reply-To: <X+z+ocwGnHT7rh84@archenemy.localdomain>

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?


  reply	other threads:[~2020-12-30 22:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 22:26 Ryan Beethe
2020-12-30 22:52 ` Ryan Beethe [this message]
2020-12-31  1:01 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X+0Ek88baOQNCWiT@archenemy.localdomain \
    --to=ryan@splintermail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).