release notes
release notes
release notes
Published 8/30/2024
MinorContains new featuresrelease notes
Published 8/30/2024
MinorContains new featuresLose focus much? This release contains support for focus-blur window events.
All you need to do is to add the program option to your application:
p := tea.NewProgram(model{}, tea.WithReportFocus())
if _, err := p.Run(); err != nil {
fmt.Fprintln(os.Stderr, "Oof:", err)
os.Exit(1)
}
Then later in your Update function, you can listen for focus-blur messages:
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.FocusMsg:
// Focused!
case tea.BlurMsg:
// Not focused :(
}
return m, nil
}
For details, see WithReportFocus.
If you're using tmux, make sure you enable the focus-events option in your config.
set-option -g focus-events on
Happy focusing (whatever that means)!
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
Lose focus much? This release contains support for focus-blur window events.
All you need to do is to add the program option to your application:
p := tea.NewProgram(model{}, tea.WithReportFocus())
if _, err := p.Run(); err != nil {
fmt.Fprintln(os.Stderr, "Oof:", err)
os.Exit(1)
}
Then later in your Update function, you can listen for focus-blur messages:
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.FocusMsg:
// Focused!
case tea.BlurMsg:
// Not focused :(
}
return m, nil
}
For details, see WithReportFocus.
If you're using tmux, make sure you enable the focus-events option in your config.
set-option -g focus-events on
Happy focusing (whatever that means)!
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.