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
+44
View File
@@ -0,0 +1,44 @@
package input
import (
"time"
tea "charm.land/bubbletea/v2"
"github.com/anotherhadi/settuings/internal/input"
)
const tickInterval = 5 * time.Second
func tickCmd() tea.Cmd {
return tea.Tick(tickInterval, func(time.Time) tea.Msg { return tickMsg{} })
}
func checkCmd() tea.Cmd {
return func() tea.Msg { return checkMsg{err: input.CheckAvailable()} }
}
func fetchLayoutCmd() tea.Cmd {
return func() tea.Msg {
layout, err := input.CurrentLayout()
return layoutMsg{layout: layout, err: err}
}
}
func setLayoutCmd(code string) tea.Cmd {
return func() tea.Msg { return setLayoutMsg{err: input.SetLayout(code)} }
}
func fetchSensitivityCmd() tea.Cmd {
return func() tea.Msg {
value, err := input.CurrentSensitivity()
return sensitivityMsg{value: value, err: err}
}
}
func setSensitivityCmd(v float64) tea.Cmd {
return func() tea.Msg { return setSensitivityMsg{err: input.SetSensitivity(v)} }
}
func resetCmd() tea.Cmd {
return func() tea.Msg { return resetMsg{err: input.Reset()} }
}