Skip to content

Allow forwarding resize events #103

@nagylzs

Description

@nagylzs

I'm working on a project that is used to start different commands on different servers, and for this, it needs to forward terminals through TCP pipes.

There are various reasons why I don't want to directly open a local ssh command on the client side; here are some of them:

  • ssh may not be available on the client side, or it might be incompatible with the ssh server
  • there may not be an ssh server running on the server side at all
  • possibly, logging in with ssh requires 2FA, and once authenticated, I want to be able to open many terminals without having to do 2FA many times

This is how I use it right now:

  1. create a process on the server side using exec.Command and then pty.Start
  2. forward the input and output of the tty (*os.File, as returned by pty.Start to the "other side", using a TCP connection / pipe
  3. open fyne.Terminal on the client side using terminal.RunWithConnection and display the terminal there

However, I'm missing a functionality: when the terminal is resized, then I'm not able to reconfigure the pty size, because that interface is hidden. It would be nice to add this feature. This would allow Terminal to be used through any pipe/network connection.

Suggested changes are:

  1. Add the possiblity to listen for pty.WinSize changes, e.g. add a Terminal.SetResizeHandler method
  2. In term_unix.go, updatePTYSize method should first call the resize handler, and after that call pty.Setsize, but only if t.pty != nil

Using this modified interface, an end user could forward not just the pty through a pipe, but also forward terminal size changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions