diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:23:53 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:23:53 -0400 |
commit | dee0f8938b62d668ed9105c96313fbd8b8bbd098 (patch) | |
tree | 2a6d9f1a427d7c4c4dabd371cff5ca0f3fb5ad70 /commands/term.go | |
parent | 16c3f0a89309541e36a2de22e91176fd13c67898 (diff) | |
download | aerc-dee0f8938b62d668ed9105c96313fbd8b8bbd098.tar.gz |
Add :term-close
Diffstat (limited to 'commands/term.go')
-rw-r--r-- | commands/term.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/commands/term.go b/commands/term.go index 7ce19471..976ce293 100644 --- a/commands/term.go +++ b/commands/term.go @@ -2,10 +2,12 @@ package commands import ( "os/exec" + "time" "git.sr.ht/~sircmpwn/aerc2/lib/ui" "git.sr.ht/~sircmpwn/aerc2/widgets" + "github.com/gdamore/tcell" "github.com/riywo/loginshell" ) @@ -32,13 +34,20 @@ func Term(aerc *widgets.Aerc, args []string) error { {ui.SIZE_WEIGHT, 1}, }) grid.AddChild(term).At(0, 1) - tab := aerc.NewTab(grid, "Terminal") + tab := aerc.NewTab(grid, args[1]) term.OnTitle = func(title string) { if title == "" { - title = "Terminal" + title = args[1] } tab.Name = title tab.Content.Invalidate() } + term.OnClose = func(err error) { + aerc.RemoveTab(grid) + if err != nil { + aerc.PushStatus(" "+err.Error(), 10*time.Second). + Color(tcell.ColorRed, tcell.ColorWhite) + } + } return nil } |