Heads up display around my existing terminal? Or terminal in terminal? #196
Replies: 1 comment 4 replies
-
Sounds like you're after something like what fzf does, but for man pages? In theory you could probably launch your tui app from the shell and pass it a fake terminal that is a wrapper around the real terminal backend but with a constrained area to render on. (Create a new backend that implements the terminal trait and passes everything on to an inner terminal field except the sizing). But all input from the stdin will end up handled by the tui app not the terminal. You could use a similar mechanism to what fzf uses to pass this back to the shell once you're done with your command. E.g. take a look at https://github.com/junegunn/fzf/tree/master/shell for how this is done in fzf. I think in some cases this just runs the command, but it's possible that the command is passed back to the shell's command buffer. It really seems like what you're asking about can be better implemented by code outside your app calling in rather than the your app wrapping the terminal. Id encourage you to spend some time looking at how your shell supports these approaches as well as what you can do with terminal multiplexers like zellij or tmux. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to use tui-rs to create a sort of "heads up display" around my existing terminal command line prompt?
For instance, I should be able to type standard unix commands, access environment variables, etc, all from a typical user input that looks just like a terminal, but then in the upper sections of the window there would be TUI widgets that perform auto-complete suggestions and other quality of life features to help the user formulate the commands they are trying to run.
For instance, let's say my hypothetical tui-rs application knows about a binary called "desert_locator". When you start typing a
desert_locator
command, it preempts your input providing suggestions like the following:The key answer I'm looking for: Does this library allow me to still let the user interact with their existing shell/environment in a non-intrusive way? Or would I have to emulate a terminal, passing all user input into a subprocess from Rust and then handle all stdout/stderr?
Beta Was this translation helpful? Give feedback.
All reactions