class RatatuiRuby::Event::FocusGained
Signals that the application is now active.
The user interacts with many windows. Your application needs to know when it has their attention.
This event confirms visibility. It fires when the terminal window moves to the foreground.
Use it to resume paused activities. Restart animations. Refresh data. The user is watching.
Only supported by some terminals (e.g. iTerm2, Kitty, newer xterm).
Example
if event.focus_gained? puts "Focus gained" end
Public Instance Methods
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 70 def ==(other) other.is_a?(FocusGained) end
Compares this event with another for equality.
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 111 def active? true end
Returns true. The application is active.
event.active? # => true
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 103 def blur? false end
Returns false. Blur is the opposite of focus gained.
event.blur? # => false
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 64 def deconstruct_keys(keys) { type: :focus_gained } end
Deconstructs the event for pattern matching.
case event in type: :focus_gained puts "Application gained focus" end
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 81 def focus? true end
Returns true. The terminal window is now in focus.
event.focus? # => true
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 46 def focus_gained? true end
Returns true for FocusGained events.
event.focus_gained? # => true event.key? # => false
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 89 def gained? true end
Returns true. The application gained focus.
event.gained? # => true
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 119 def inactive? false end
Returns false. The application is not inactive.
event.inactive? # => false
Source
# File lib/ratatui_ruby/event/focus_gained.rb, line 96 def lost? false end
Returns false. This is not a focus lost event.
event.lost? # => false