Documentation ¶
Overview ¶
Package keypress is a library for advanced keypress detection and parsing.
It provides a callback with both a human-readable name for the event detected, along with the raw data behind it.
The following are supported human-readable names:
Enter Esc Mouse Moved Mouse Down Mouse Up Scroll Up Scroll Down [letter] Alt+[letter] Alt+Shift+[letter] Ctrl+[letter] Up Down Left Right Shift+[arrow] Alt+[arrow] Alt+Shift+[arrow] Ctrl+[arrow]
Index ¶
- func GetTermSize() (int, int, error)
- func Listen(callback func(parsedData interface{}, rawData []byte))
- func ShouldProcessMouse(should bool)
- func Shutdown()
- type AltArrow
- type AltChar
- type AltShiftArrow
- type AltShiftChar
- type Arrow
- type Character
- type CtrlArrow
- type CtrlChar
- type Direction
- type Enter
- type Esc
- type MouseDown
- type MouseMove
- type MouseUp
- type Resize
- type ScrollDown
- type ScrollUp
- type ShiftArrow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTermSize ¶
GetTermSize returns the terminal dimensions w, h, err
func Listen ¶
func Listen(callback func(parsedData interface{}, rawData []byte))
Listen is a blocking function that indefinitely listens for keypresses. When it detects a keypress, it passes on to the callback a human-readable interpretation of the event (e.g. Alt+Shift+Up) along with the raw string of text received by the terminal.
func ShouldProcessMouse ¶
func ShouldProcessMouse(should bool)
ShouldProcessMouse controls whether typical mouse actions (e.g. selection) should be disabled in exhange for i3-mux-specific features
Types ¶
type AltShiftArrow ¶
type AltShiftArrow struct {
Direction
}
AltShiftArrow is for alt+shift+[arrow key]
type AltShiftChar ¶
type AltShiftChar struct {
Char rune
}
AltShiftChar is for alt+shift+[character]
type Character ¶
type Character struct {
Char rune
}
Character is for when a single non-modifier key is pressed. It has a long name to prevent confusion with Char used in other structs
type MouseDown ¶
type MouseDown struct {
X, Y int
}
MouseDown is for when the primary mouse button is pressed down
type MouseMove ¶
type MouseMove struct {
// contains filtered or unexported fields
}
MouseMove is for when the terminal reports mouse movement
type MouseUp ¶
type MouseUp struct {
X, Y int
}
MouseUp is for when the primary mouse button is no longer being pressed
type ScrollDown ¶
type ScrollDown struct{}
ScrollDown moves the viewport down, and the screen contents up