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 /app/aerc.go | |
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 'app/aerc.go')
-rw-r--r-- | app/aerc.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/aerc.go b/app/aerc.go index b6bc2430..38340c7d 100644 --- a/app/aerc.go +++ b/app/aerc.go @@ -88,17 +88,17 @@ func (aerc *Aerc) Init( for _, acct := range config.Accounts { view, err := NewAccountView(acct, deferLoop) if err != nil { - tabs.Add(errorScreen(err.Error()), acct.Name, nil) + tabs.Add(errorScreen(err.Error()), acct.Name, nil, false) } else { aerc.accounts[acct.Name] = view - view.tab = tabs.Add(view, acct.Name, view.UiConfig()) + view.tab = tabs.Add(view, acct.Name, view.UiConfig(), false) } } if len(config.Accounts) == 0 { wizard := NewAccountWizard() wizard.Focus(true) - aerc.NewTab(wizard, "New account") + aerc.NewTab(wizard, "New account", false) } tabs.Select(0) @@ -503,12 +503,12 @@ func (aerc *Aerc) SelectedTab() *ui.Tab { return aerc.tabs.Selected() } -func (aerc *Aerc) NewTab(clickable ui.Drawable, name string) *ui.Tab { +func (aerc *Aerc) NewTab(clickable ui.Drawable, name string, background bool) *ui.Tab { uiConf := config.Ui if acct := aerc.account(clickable); acct != nil { uiConf = acct.UiConfig() } - tab := aerc.tabs.Add(clickable, name, uiConf) + tab := aerc.tabs.Add(clickable, name, uiConf, background) aerc.UpdateStatus() return tab } @@ -806,7 +806,7 @@ func (aerc *Aerc) mailto(addr *url.URL) error { if to == nil { composer.FocusEditor("to") } - composer.Tab = aerc.NewTab(composer, title) + composer.Tab = aerc.NewTab(composer, title, false) for _, file := range attachments { composer.AddAttachment(file) @@ -835,10 +835,10 @@ func (aerc *Aerc) mbox(source string) error { mboxView, err := NewAccountView(&acctConf, nil) if err != nil { - aerc.NewTab(errorScreen(err.Error()), acctConf.Name) + aerc.NewTab(errorScreen(err.Error()), acctConf.Name, false) } else { aerc.accounts[acctConf.Name] = mboxView - aerc.NewTab(mboxView, acctConf.Name) + aerc.NewTab(mboxView, acctConf.Name, false) } return nil } |