Tab cycles panels within a view; views switch only via F1-F4/Alt+digit

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 19:22:24 +02:00
co-authored by Claude Sonnet 5.5
parent 0b4af81203
commit 093fe53291
6 changed files with 25 additions and 18 deletions
+1 -7
View File
@@ -164,7 +164,7 @@ func (a *App) Run() error {
}
func (a *App) renderStatus() {
hints := "[gray]?/F9 help · q quit · Tab/F1-F4 views · / search"
hints := "[gray]?/F9 help · q quit · F1-F4 views · Tab panels · / search"
if len(a.overlays) > 0 {
hints = "[gray]Esc back · Ctrl+C quit"
}
@@ -260,12 +260,6 @@ func (a *App) handleKey(ev *tcell.EventKey) *tcell.EventKey {
return ev
}
switch ev.Key() {
case tcell.KeyTab:
a.switchTo((a.active + 1) % len(a.views))
return nil
case tcell.KeyBacktab:
a.switchTo((a.active + len(a.views) - 1) % len(a.views))
return nil
case tcell.KeyRune:
if ev.Rune() == 'q' {
a.app.Stop()
+12 -4
View File
@@ -84,13 +84,20 @@ func newDownloadsView(app *App, sab *sabnzbd.Client, sources []arrSource, interv
common := func(extra map[rune]func()) func(*tcell.EventKey) *tcell.EventKey {
keys := map[rune]func(){
'r': v.refreshNow,
'h': v.nextPanel,
'p': v.togglePause,
}
for r, f := range extra {
keys[r] = f
}
return func(ev *tcell.EventKey) *tcell.EventKey {
switch ev.Key() {
case tcell.KeyTab:
v.nextPanel(1)
return nil
case tcell.KeyBacktab:
v.nextPanel(-1)
return nil
}
if ev.Key() == tcell.KeyRune {
if f, ok := keys[ev.Rune()]; ok {
f()
@@ -114,12 +121,13 @@ func newDownloadsView(app *App, sab *sabnzbd.Client, sources []arrSource, interv
return v
}
// nextPanel moves focus to the next panel (queue, Radarr/Sonarr queue, history).
func (v *downloadsView) nextPanel() {
// nextPanel moves focus to the next (dir 1) or previous (dir -1) panel:
// queue, Radarr/Sonarr queue, history.
func (v *downloadsView) nextPanel(dir int) {
cur := v.app.app.GetFocus()
for i, p := range v.panels {
if p == cur {
v.app.app.SetFocus(v.panels[(i+1)%len(v.panels)])
v.app.app.SetFocus(v.panels[(i+dir+len(v.panels))%len(v.panels)])
return
}
}
+2 -2
View File
@@ -6,7 +6,8 @@ import (
)
const helpText = `[yellow]Global[-]
F1-F4, Alt+1-4, Tab switch view
F1-F4, Alt+1-4 switch view
Tab, Shift+Tab switch panel within a view
?, F9 this help (F9 works while typing)
q, Ctrl+C quit
Esc close dialog / go back
@@ -22,7 +23,6 @@ const helpText = `[yellow]Global[-]
f hide rejected releases
[yellow]Downloads[-]
h next panel
p pause / resume the SABnzbd queue
d delete the selected job or entry
b remove from arr queue + blocklist
+5 -1
View File
@@ -70,7 +70,7 @@ func newSearchView(app *App, be backend, cfg config.Arr) *searchView {
case tcell.KeyEnter:
v.search(strings.TrimSpace(v.input.GetText()))
v.app.app.SetFocus(v.list)
case tcell.KeyEscape, tcell.KeyTab:
case tcell.KeyEscape, tcell.KeyTab, tcell.KeyBacktab:
v.app.app.SetFocus(v.list)
}
})
@@ -85,6 +85,10 @@ func newSearchView(app *App, be backend, cfg config.Arr) *searchView {
v.list.SetChangedFunc(func(i int, _, _ string, _ rune) { v.showDetails(i) })
v.list.SetSelectedFunc(func(i int, _, _ string, _ rune) { v.add(i) })
v.list.SetInputCapture(func(ev *tcell.EventKey) *tcell.EventKey {
if ev.Key() == tcell.KeyTab || ev.Key() == tcell.KeyBacktab {
v.app.app.SetFocus(v.input)
return nil
}
if ev.Key() != tcell.KeyRune {
return ev
}