about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-17 17:08:54 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-17 17:08:54 -0400
commit16c3f0a89309541e36a2de22e91176fd13c67898 (patch)
tree23c5946f4f56256a07a512d7c49a89c675c8ca0b /widgets
parent14cb8cb51f4a1dfca2486d154e2206b19f9401a7 (diff)
downloadaerc-16c3f0a89309541e36a2de22e91176fd13c67898.tar.gz
Handle terminal title, login shell
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go1
-rw-r--r--widgets/terminal.go13
2 files changed, 13 insertions, 1 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index b94d03d..a968ab1 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -96,7 +96,6 @@ func (aerc *Aerc) Draw(ctx *libui.Context) {
 
 func (aerc *Aerc) Event(event tcell.Event) bool {
 	if aerc.focused != nil {
-		aerc.logger.Println("sending event to focused child")
 		return aerc.focused.Event(event)
 	}
 
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
+}