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 /lib | |
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 'lib')
-rw-r--r-- | lib/ui/tab.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go index 5d824955..64e4155a 100644 --- a/lib/ui/tab.go +++ b/lib/ui/tab.go @@ -65,14 +65,18 @@ func NewTabs(uiConf *config.UIConfig) *Tabs { return tabs } -func (tabs *Tabs) Add(content Drawable, name string, uiConf *config.UIConfig) *Tab { +func (tabs *Tabs) Add( + content Drawable, name string, uiConf *config.UIConfig, background bool, +) *Tab { tab := &Tab{ Content: content, Name: name, uiConf: uiConf, } tabs.tabs = append(tabs.tabs, tab) - tabs.selectPriv(len(tabs.tabs) - 1) + if !background { + tabs.selectPriv(len(tabs.tabs) - 1) + } return tab } |