diff options
author | Aron Lebani <aron@lebani.dev> | 2024-08-02 09:59:33 +1000 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-04 18:26:58 +0200 |
commit | fff69046b02f3d9ea0218ff071ba5e4d5b3a3c12 (patch) | |
tree | 3537292b6b3070a44196629c6df3b544ce4d3c04 /commands/account | |
parent | 2cd0cec19d6146d6e9681b648d978f463b107008 (diff) | |
download | aerc-fff69046b02f3d9ea0218ff071ba5e4d5b3a3c12.tar.gz |
view-message: add option to view message in background tab
Add a -b flag to the :view command to open messages in a background tab
instead of automatically switching to the new tab after opening. This is
similar to opening browser tabs in the background. More generally, adds
a new function app.NewBackgroundTab so that it is possible to enable other
tabs to be opened in the background in the future.
Implements: https://todo.sr.ht/~rjarry/aerc/266
Changelog-added: Add `-b` flag to the `:view` command to open messages
in a background tab.
Signed-off-by: Aron Lebani <aron@lebani.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/account')
-rw-r--r-- | commands/account/view.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/commands/account/view.go b/commands/account/view.go index 9fa531b7..58450044 100644 --- a/commands/account/view.go +++ b/commands/account/view.go @@ -13,7 +13,8 @@ import ( ) type ViewMessage struct { - Peek bool `opt:"-p"` + Peek bool `opt:"-p"` + Background bool `opt:"-b"` } func init() { @@ -49,8 +50,12 @@ func (v ViewMessage) Execute(args []string) error { app.PushError(msg.Error.Error()) return nil } - lib.NewMessageStoreView(msg, !v.Peek && acct.UiConfig().AutoMarkRead, - store, app.CryptoProvider(), app.DecryptKeys, + lib.NewMessageStoreView( + msg, + !v.Peek && acct.UiConfig().AutoMarkRead, + store, + app.CryptoProvider(), + app.DecryptKeys, func(view lib.MessageView, err error) { if err != nil { app.PushError(err.Error()) @@ -68,7 +73,11 @@ func (v ViewMessage) Execute(args []string) error { acct.PushError(err) return } - app.NewTab(viewer, buf.String()) + if v.Background { + app.NewBackgroundTab(viewer, buf.String()) + } else { + app.NewTab(viewer, buf.String()) + } }) return nil } |