diff options
Diffstat (limited to 'widgets/terminal.go')
-rw-r--r-- | widgets/terminal.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go index 502d974..bd84ab4 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -25,6 +25,8 @@ type Terminal struct { pty *os.File start chan interface{} vterm *vterm.VTerm + + OnTitle func(title string) } func NewTerminal(cmd *exec.Cmd) (*Terminal, error) { @@ -51,6 +53,7 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) { screen := term.vterm.ObtainScreen() screen.OnDamage = term.onDamage screen.OnMoveCursor = term.onMoveCursor + screen.OnSetTermProp = term.onSetTermProp screen.Reset(true) state := term.vterm.ObtainState() @@ -231,3 +234,13 @@ func (term *Terminal) onMoveCursor(old *vterm.Pos, term.resetCursor() return 1 } + +func (term *Terminal) onSetTermProp(prop int, val *vterm.VTermValue) int { + switch prop { + case vterm.VTERM_PROP_TITLE: + if term.OnTitle != nil { + term.OnTitle(val.String) + } + } + return 1 +} |