add "inputs" page

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-08-13 17:59:03 +02:00
parent df530f39b0
commit 6e4f8b889c
23 changed files with 1047 additions and 2 deletions
+4 -1
View File
@@ -13,6 +13,7 @@ import (
audioUI "github.com/anotherhadi/settuings/internal/ui/audio"
bluetoothUI "github.com/anotherhadi/settuings/internal/ui/bluetooth"
notificationsUI "github.com/anotherhadi/settuings/internal/ui/components/notifications"
inputUI "github.com/anotherhadi/settuings/internal/ui/input"
networkUI "github.com/anotherhadi/settuings/internal/ui/network"
powerUI "github.com/anotherhadi/settuings/internal/ui/power"
"github.com/sirupsen/logrus"
@@ -45,6 +46,7 @@ type Model struct {
bluetooth bluetoothUI.Model
audio audioUI.Model
power powerUI.Model
input inputUI.Model
notifications notificationsUI.Model
}
@@ -74,6 +76,7 @@ func New(initialPage string) (Model, error) {
bluetooth: bluetoothUI.New(),
audio: audioUI.New(),
power: powerUI.New(),
input: inputUI.New(),
notifications: notificationsUI.New(),
sidebarState: sidebarState(cfg.TUI.DefaultSidebarState),
logPath: logPath,
@@ -92,7 +95,7 @@ func New(initialPage string) (Model, error) {
func (m Model) FatalErr() error { return m.fatalErr }
func (m Model) Init() tea.Cmd {
cmds := []tea.Cmd{m.about.Init(), m.network.Init(), m.bluetooth.Init(), m.audio.Init(), m.power.Init()}
cmds := []tea.Cmd{m.about.Init(), m.network.Init(), m.bluetooth.Init(), m.audio.Init(), m.power.Init(), m.input.Init()}
if m.page != pageAbout {
cmds = append(cmds, m.activatePage(m.page))
}
+16
View File
@@ -9,6 +9,7 @@ import (
aboutUI "github.com/anotherhadi/settuings/internal/ui/about"
audioUI "github.com/anotherhadi/settuings/internal/ui/audio"
bluetoothUI "github.com/anotherhadi/settuings/internal/ui/bluetooth"
inputUI "github.com/anotherhadi/settuings/internal/ui/input"
networkUI "github.com/anotherhadi/settuings/internal/ui/network"
powerUI "github.com/anotherhadi/settuings/internal/ui/power"
)
@@ -21,6 +22,7 @@ const (
pageBluetooth page = "Bluetooth"
pageAudio page = "Audio"
pagePower page = "Power"
pageInputs page = "Inputs"
)
// pageEntry describes a page and all its integration hooks.
@@ -120,6 +122,20 @@ var pageRegistry = []pageEntry{
resize: func(m *Model, w, h int) { m.power.SetSize(w, h) },
activate: func(m *Model) tea.Cmd { return m.power.Activate() },
},
{
id: pageInputs,
icon: func() string { return icons.I.Inputs },
render: func(m *Model) string { return m.input.View().Content },
update: func(m *Model, msg tea.Msg) tea.Cmd {
updated, cmd := m.input.Update(msg)
m.input = updated.(inputUI.Model)
return cmd
},
isEditing: func(m *Model) bool { return m.input.IsEditing() },
resize: func(m *Model, w, h int) { m.input.SetSize(w, h) },
activate: func(m *Model) tea.Cmd { return m.input.Activate() },
},
}
// PageNames returns the valid page identifiers, in sidebar order, usable