diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:08:54 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:08:54 -0400 |
commit | 16c3f0a89309541e36a2de22e91176fd13c67898 (patch) | |
tree | 23c5946f4f56256a07a512d7c49a89c675c8ca0b /widgets/terminal.go | |
parent | 14cb8cb51f4a1dfca2486d154e2206b19f9401a7 (diff) | |
download | aerc-16c3f0a89309541e36a2de22e91176fd13c67898.tar.gz |
Handle terminal title, login shell
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 +} |