Skip to content

Commit 86cce84

Browse files
committed
Add navigation via numbers
A la lazygit, we can now navigate between panels using numbers (1,2,3,4,5,6,7) Add translation for number navigation reformat oops fix translation case & generate docs pluralize networks
1 parent 80af149 commit 86cce84

12 files changed

+84
-0
lines changed

docs/keybindings/Keybindings_de.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_en.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_es.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_fr.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_nl.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_pl.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_pt.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: modo de tela seguinte (normal/meia/tela cheia)
106106
<kbd>_</kbd>: modo de tela anterior
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_tr.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_zh.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: 下一个屏幕模式(正常/半屏/全屏)
106106
<kbd>_</kbd>: 上一个屏幕模式
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

pkg/gui/keybindings.go

+9
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,15 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
534534
}...)
535535
}
536536

537+
bindings = append(bindings, []*Binding{
538+
{Handler: gui.handleGoTo(gui.Panels.Projects.View), Key: '1', Description: gui.Tr.FocusProjects},
539+
{Handler: gui.handleGoTo(gui.Panels.Services.View), Key: '2', Description: gui.Tr.FocusServices},
540+
{Handler: gui.handleGoTo(gui.Panels.Containers.View), Key: '3', Description: gui.Tr.FocusContainers},
541+
{Handler: gui.handleGoTo(gui.Panels.Images.View), Key: '4', Description: gui.Tr.FocusImages},
542+
{Handler: gui.handleGoTo(gui.Panels.Volumes.View), Key: '5', Description: gui.Tr.FocusVolumes},
543+
{Handler: gui.handleGoTo(gui.Panels.Networks.View), Key: '6', Description: gui.Tr.FocusNetworks},
544+
}...)
545+
537546
for _, panel := range gui.allListPanels() {
538547
setUpDownClickBindings(panel.GetView().Name(), panel.HandlePrevLine, panel.HandleNextLine, panel.HandleClick)
539548
}

pkg/gui/view_helpers.go

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ import (
1212
"github.com/spkg/bom"
1313
)
1414

15+
func (gui *Gui) handleGoTo(view *gocui.View) func(g *gocui.Gui, v *gocui.View) error {
16+
return func(g *gocui.Gui, v *gocui.View) error {
17+
gui.resetMainView()
18+
return gui.switchFocus(view)
19+
}
20+
}
21+
1522
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
1623
sideViewNames := gui.sideViewNames()
1724
var focusedViewName string

pkg/i18n/english.go

+14
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ type TranslationSet struct {
128128
LcNextScreenMode string
129129
LcPrevScreenMode string
130130
FilterPrompt string
131+
132+
FocusProjects string
133+
FocusServices string
134+
FocusContainers string
135+
FocusImages string
136+
FocusVolumes string
137+
FocusNetworks string
131138
}
132139

133140
func englishSet() TranslationSet {
@@ -263,5 +270,12 @@ func englishSet() TranslationSet {
263270
LcNextScreenMode: "next screen mode (normal/half/fullscreen)",
264271
LcPrevScreenMode: "prev screen mode",
265272
FilterPrompt: "filter",
273+
274+
FocusProjects: "focus projects panel",
275+
FocusServices: "focus services panel",
276+
FocusContainers: "focus containers panel",
277+
FocusImages: "focus images panel",
278+
FocusVolumes: "focus volumes panel",
279+
FocusNetworks: "focus networks panel",
266280
}
267281
}

0 commit comments

Comments
 (0)