xgbkb

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: GPL-3.0 Imports: 4 Imported by: 1

README

xgbkb

A module providing keyboard input utilities to be used alongside xgb and xgbutil. This module does not use the XKB extension (yet), instead it implements semi-equivalent functionality on its own. Note that may be issues here because X keyboard input without XKB is horrifically cursed.

Documentation

Overview

Package xgbkb provides keyboard input utilities to be used alongside xgb and xgbutil.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(connection *xgbutil.XUtil)

Initialize grabs keyboard mapping information from the X server. This function must be called before calling any other functions in this package. keybind.Initialize must also be called before this function is called.

func IsOnNumpad

func IsOnNumpad(symbol xproto.Keysym) bool

IsOnNumpad returns whether the given keysym resides on the numpad.

func KeycodeToKeysym

func KeycodeToKeysym(keycode xproto.Keycode, state uint16) (xproto.Keysym, rune)

KeycodeToButton converts an X keycode to a tomo keycode. It implements a more fleshed out version of some of the logic found in xgbutil/keybind/encoding.go to get a full keycode to keysym conversion. To avoid redundant work, this function will also return the rune corresponding to the keycode.

func KeysymToKeycode

func KeysymToKeycode(
	symbol xproto.Keysym,
) (
	code xproto.Keycode,
)

KeysymToKeycode converts an X keysym to an X keycode, instead of the other way around.

func KeysymToMask

func KeysymToMask(symbol xproto.Keysym) uint16

KeysymToMask returns the X modmask for a given modifier key.

func KeysymToRune

func KeysymToRune(keysym xproto.Keysym) rune

KeysymToRune takes in an X keysym and outputs a utf32 code point. If a corresponding code point was not found, zero will be returned.

Types

type Modifiers

type Modifiers struct {
	CapsLock   bool
	ShiftLock  bool
	NumLock    bool
	ModeSwitch bool

	Shift   bool
	Control bool
	Alt     bool
	Meta    bool
	Super   bool
	Hyper   bool
}

Modifiers lists which modifier keys are toggled on or being pressed.

func StateToModifiers

func StateToModifiers(state uint16) Modifiers

StateToModifiers converts a modifier state given by a keyboard or mouse event to a Modifiers struct.

func (Modifiers) String

func (modifiers Modifiers) String() (out string)

String returns a human-readable comma-separated list of all active modifiers.

Directories

Path Synopsis
examples
keypress
Example keypress is xgbutil/_examples/keypress-english modified to demonstrate the functionality in this module.
Example keypress is xgbutil/_examples/keypress-english modified to demonstrate the functionality in this module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL