diff --git a/config/config.go b/config/config.go index e34c7c6..fc090e2 100644 --- a/config/config.go +++ b/config/config.go @@ -12,14 +12,15 @@ import ( // Config holds CLI flag values to pre-fill the TUI form. type Config struct { - From string - To string - Date string - Time string - IsArrivalTime bool - NerdFont bool - Theme Theme - CurrentVersion string + From string + To string + Date string + Time string + IsArrivalTime bool + NerdFont bool + DisableCursorBlink bool + Theme Theme + CurrentVersion string } // UIConfig groups all UI-related settings. diff --git a/main.go b/main.go index 8579b1a..86e8333 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ func main() { timeStr := flag.String("time", "", "Pre-fill time [HH:MM]") arrival := flag.Bool("arrival", false, "Set date/time as arrival instead of departure time") flag.Bool("nerdfont", true, "Use Nerd Font icons") + cursorBlink := flag.Bool("cursor-blink", true, "Enable terminal cursor blink") showVersion := flag.BoolP("version", "v", false, "Print version and exit") // --help @@ -74,6 +75,8 @@ func main() { cfg.NerdFont = nf } + cfg.DisableCursorBlink = !*cursorBlink + m := ui.NewModel(cfg) if _, err := tea.NewProgram(m, tea.WithAltScreen()).Run(); err != nil { diff --git a/ui/model.go b/ui/model.go index 02d9583..9900d43 100644 --- a/ui/model.go +++ b/ui/model.go @@ -65,8 +65,9 @@ type appModel struct { inputs []textinput.Model icons iconSet styles styles - nerdFont bool - isArrivalTime bool + nerdFont bool + isArrivalTime bool + disableCursorBlink bool connections []model.Connection loading bool errorMsg error @@ -94,7 +95,8 @@ func NewModel(cfg config.Config) appModel { icons: newIconSet(cfg.NerdFont), styles: newStyles(cfg.Theme), nerdFont: cfg.NerdFont, - isArrivalTime: cfg.IsArrivalTime, + isArrivalTime: cfg.IsArrivalTime, + disableCursorBlink: cfg.DisableCursorBlink, currentVersion: cfg.CurrentVersion, } @@ -152,6 +154,9 @@ func NewModel(cfg config.Config) appModel { // Init implements tea.Model. func (m appModel) Init() tea.Cmd { + if m.disableCursorBlink { + return checkVersionCmd(m.currentVersion) + } return tea.Batch(textinput.Blink, checkVersionCmd(m.currentVersion)) }