On Fri, Sep 15, 2017 at 09:24:55PM +0000, Eric Pruitt wrote:
> On Fri, Sep 15, 2017 at 09:41:32PM +0200, Hadrien Lacour wrote:
> > I basically wanted a way to open a terminal with the beginning of a
> > command ("pass -c " in my case) already typed.
> >
> > I finally settled for the dmenu integration, but this still could be
> > useful. I'll probably have better chance with xdotool.
>
> The only method I'm aware of for pushing characters to a terminal
> requires using ioctl, and I think (but am not certain) this only works
> if the process in question is the session leader. In C, this looks like
> "ioctl(tty, TIOCSTI, data)" where "tty" is a file descriptor for the
> terminal. Maybe you could create a wrapper program that uses ioctl to
> push bytes into the input buffer then spawns a shell.
>
> Eric
>Thanks, it works perfectly. Too bad termios doesn't seem to make this possible. Also, understandably, it only works on the current tty (probably what you meant by "session leader").
