Documentation ¶
Index ¶
- func RegisterAPCHandler(APC string, handler APCHandler)
- type APCHandler
- type Config
- type Printer
- type PrinterFunc
- type ReadWriterConfigurator
- type ReadWriterConfiguratorFunc
- type Terminal
- func (t *Terminal) AcceptsTab() bool
- func (t *Terminal) AddListener(listener chan Config)
- func (t *Terminal) CreateRenderer() fyne.WidgetRenderer
- func (t *Terminal) Cursor() desktop.Cursor
- func (t *Terminal) DoubleTapped(pe *fyne.PointEvent)
- func (t *Terminal) DragEnd()
- func (t *Terminal) Dragged(d *fyne.DragEvent)
- func (t *Terminal) Exit()
- func (t *Terminal) ExitCode() int
- func (t *Terminal) FocusGained()
- func (t *Terminal) FocusLost()
- func (t *Terminal) Focused() bool
- func (t *Terminal) KeyDown(e *fyne.KeyEvent)
- func (t *Terminal) KeyUp(e *fyne.KeyEvent)
- func (t *Terminal) MinSize() fyne.Size
- func (t *Terminal) MouseDown(ev *desktop.MouseEvent)
- func (t *Terminal) MouseUp(ev *desktop.MouseEvent)
- func (t *Terminal) RemoveListener(listener chan Config)
- func (t *Terminal) Resize(s fyne.Size)
- func (t *Terminal) RunLocalShell() error
- func (t *Terminal) RunWithConnection(in io.WriteCloser, out io.Reader) error
- func (t *Terminal) SelectedText() string
- func (t *Terminal) SetDebug(debug bool)
- func (t *Terminal) SetPrinterFunc(printerFunc PrinterFunc)
- func (t *Terminal) SetReadWriter(mw ReadWriterConfigurator)
- func (t *Terminal) SetStartDir(path string)
- func (t *Terminal) Tapped(ev *fyne.PointEvent)
- func (t *Terminal) Text() string
- func (t *Terminal) TouchCancel(ev *mobile.TouchEvent)
- func (t *Terminal) TouchDown(ev *mobile.TouchEvent)
- func (t *Terminal) TouchUp(ev *mobile.TouchEvent)
- func (t *Terminal) TypedKey(e *fyne.KeyEvent)
- func (t *Terminal) TypedRune(r rune)
- func (t *Terminal) TypedShortcut(s fyne.Shortcut)
- func (t *Terminal) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAPCHandler ¶
func RegisterAPCHandler(APC string, handler APCHandler)
RegisterAPCHandler registers a APC handler for the given APC command string.
Types ¶
type APCHandler ¶
APCHandler handles a APC command for the given terminal.
type Config ¶
Config is the state of a terminal, updated upon certain actions or commands. Use Terminal.OnConfigure hook to register for changes.
type Printer ¶
type Printer interface {
Print([]byte)
}
Printer is used for spooling print data when its received.
type PrinterFunc ¶
type PrinterFunc func([]byte)
PrinterFunc is a helper function to enable easy implementation of printers.
type ReadWriterConfigurator ¶
type ReadWriterConfigurator interface { // SetupReadWriter configures the input and output streams for the terminal. // It takes an input reader (r) and an output writer (w) as arguments. // The function returns a possibly modified reader and writer that // the terminal will use for I/O operations. SetupReadWriter(r io.Reader, w io.WriteCloser) (io.Reader, io.WriteCloser) }
ReadWriterConfigurator is an interface that defines the methods required to set up the input (reader) and output (writer) streams for the terminal. Implementations of this interface can modify or wrap the reader and writer.
type ReadWriterConfiguratorFunc ¶
type ReadWriterConfiguratorFunc func(r io.Reader, w io.WriteCloser) (io.Reader, io.WriteCloser)
ReadWriterConfiguratorFunc is a function type that matches the signature of the SetupReadWriter method in the Middleware interface.
func (ReadWriterConfiguratorFunc) SetupReadWriter ¶
func (m ReadWriterConfiguratorFunc) SetupReadWriter(r io.Reader, w io.WriteCloser) (io.Reader, io.WriteCloser)
SetupReadWriter allows ReadWriterConfiguratorFunc to satisfy the Middleware interface. It calls the ReadWriterConfiguratorFunc itself.
type Terminal ¶
type Terminal struct { widget.BaseWidget fyne.ShortcutHandler // contains filtered or unexported fields }
Terminal is a terminal widget that loads a shell and handles input/output.
func (*Terminal) AcceptsTab ¶
AcceptsTab indicates that this widget will use the Tab key (avoids loss of focus).
func (*Terminal) AddListener ¶
AddListener registers a new outgoing channel that will have our Config sent each time it changes.
func (*Terminal) CreateRenderer ¶
func (t *Terminal) CreateRenderer() fyne.WidgetRenderer
CreateRenderer requests a new renderer for this terminal (just a wrapper around the TextGrid)
func (*Terminal) DoubleTapped ¶
func (t *Terminal) DoubleTapped(pe *fyne.PointEvent)
DoubleTapped handles the double tapped event.
func (*Terminal) DragEnd ¶
func (t *Terminal) DragEnd()
DragEnd is called by fyne when the left mouse is released after a Drag event.
func (*Terminal) Dragged ¶
func (t *Terminal) Dragged(d *fyne.DragEvent)
Dragged is called by fyne when the left mouse is down and moved whilst over the widget.
func (*Terminal) Exit ¶
func (t *Terminal) Exit()
Exit requests that this terminal exits. If there are embedded shells it will exit the child one only.
func (*Terminal) ExitCode ¶
ExitCode returns the exit code from the terminal's shell. Returns -1 if called before shell was started or before shell exited. Also returns -1 if shell was terminated by a signal.
func (*Terminal) FocusGained ¶
func (t *Terminal) FocusGained()
FocusGained notifies the terminal that it has focus
func (*Terminal) FocusLost ¶
func (t *Terminal) FocusLost()
FocusLost tells the terminal it no longer has focus
func (*Terminal) KeyDown ¶
func (t *Terminal) KeyDown(e *fyne.KeyEvent)
KeyDown is called when we get a down key event
func (*Terminal) KeyUp ¶
func (t *Terminal) KeyUp(e *fyne.KeyEvent)
KeyUp is called when we get an up key event
func (*Terminal) MinSize ¶
func (t *Terminal) MinSize() fyne.Size
MinSize provides a size large enough that a terminal could technically funcion.
func (*Terminal) MouseDown ¶
func (t *Terminal) MouseDown(ev *desktop.MouseEvent)
MouseDown handles the down action for desktop mouse events.
func (*Terminal) MouseUp ¶
func (t *Terminal) MouseUp(ev *desktop.MouseEvent)
MouseUp handles the up action for desktop mouse events.
func (*Terminal) RemoveListener ¶
RemoveListener de-registers a Config channel and closes it
func (*Terminal) Resize ¶
func (t *Terminal) Resize(s fyne.Size)
Resize is called when this terminal widget has been resized. It ensures that the virtual terminal is within the bounds of the widget.
func (*Terminal) RunLocalShell ¶
RunLocalShell starts the terminal by loading a shell and starting to process the input/output.
func (*Terminal) RunWithConnection ¶
RunWithConnection starts the terminal by connecting to an external resource like an SSH connection.
func (*Terminal) SelectedText ¶
SelectedText gets the text that is currently selected.
func (*Terminal) SetDebug ¶
SetDebug turns on output about terminal codes and other errors if the parameter is `true`.
func (*Terminal) SetPrinterFunc ¶
func (t *Terminal) SetPrinterFunc(printerFunc PrinterFunc)
SetPrinterFunc sets the printer function which is executed when printing.
func (*Terminal) SetReadWriter ¶
func (t *Terminal) SetReadWriter(mw ReadWriterConfigurator)
SetReadWriter sets the readWriterConfigurator function that will be used when creating a new terminal. The readWriterConfigurator function is responsible for setting up the I/O readers and writers.
func (*Terminal) SetStartDir ¶
SetStartDir can be called before one of the Run calls to specify the initial directory.
func (*Terminal) Tapped ¶
func (t *Terminal) Tapped(ev *fyne.PointEvent)
Tapped makes sure we ask for focus if user taps us.
func (*Terminal) Text ¶
Text returns the contents of the buffer as a single string joined with `\n` (no style information).
func (*Terminal) TouchCancel ¶
func (t *Terminal) TouchCancel(ev *mobile.TouchEvent)
TouchCancel handles the tap action for mobile apps that lose focus during tap.
func (*Terminal) TouchDown ¶
func (t *Terminal) TouchDown(ev *mobile.TouchEvent)
TouchDown handles the down action for mobile touch events.
func (*Terminal) TouchUp ¶
func (t *Terminal) TouchUp(ev *mobile.TouchEvent)
TouchUp handles the up action for mobile touch events.
func (*Terminal) TypedKey ¶
func (t *Terminal) TypedKey(e *fyne.KeyEvent)
TypedKey will be called if a non-printable keyboard event occurs
func (*Terminal) TypedShortcut ¶
func (t *Terminal) TypedShortcut(s fyne.Shortcut)
TypedShortcut handles key combinations, we pass them on to the tty.