Vtex.Focus (Vtex v0.1.0)

Copy Markdown View Source

Focus-reporting support: the control sequences that turn it on and off.

When enabled (enable/0), the terminal reports when its window gains or loses focus, which Vtex.Input surfaces as the :focus_in and :focus_out events — handy for pausing a game or dimming a UI when the user tabs away.

Like Vtex.Mouse and Vtex.Paste, enable/0/disable/0 are output helpers that return bytes for you to write; the library performs no IO of its own.

Summary

Functions

The control sequence that disables focus reporting. Write it on teardown.

The control sequence that enables focus reporting. Write it to the terminal.

Functions

disable()

@spec disable() :: binary()

The control sequence that disables focus reporting. Write it on teardown.

Examples

iex> Vtex.Focus.disable() =~ "1004l"
true

enable()

@spec enable() :: binary()

The control sequence that enables focus reporting. Write it to the terminal.

Examples

iex> Vtex.Focus.enable() =~ "1004h"
true