summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
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
+}