Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RateLimiter = rate.NewLimiter(rate.Every(20*time.Millisecond), 1)
RateLimiter throttles layout updates to once every ~20ms to avoid unexpected behaviour.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // Next switches to the next layout in the layout list. This will wrap // around if the last layout is reached. Next() // Next switches to the previous layout in the layout list. This will wrap // around if the first layout is reached. Previous() // SetLayout sets a new layout. Layout strings that were not configured on // the module are ignored. SetLayout(layout string) // GetLayouts returns all layouts that are configured on the keyboard module // instance that the controller belongs to. GetLayouts() []string }
Controller can switch between keyboard layouts.
type Layout ¶
type Layout struct { Controller // Name is the name of the keyboard layout, e.g "us". Name string }
Layout contains the name of the currently set keyboard layout. It also exposes a Controller to switch between available layouts.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is a module for displaying and interacting with the keyboard layout that is configured by the user.
func New ¶
New creates a new *Module with given keyboard provider. By default, the lists of layouts is cycled through whenever the keyboard layout display in the bar is clicked or scrolled. By default, the module will refresh every 10 seconds. The refresh interval can be configured using `Every`.
func (*Module) Every ¶
Every configures the refresh interval for the module. Passing a zero interval will disable refreshing.