Documentation ¶
Index ¶
- Constants
- Variables
- type ButtonEvent
- type Client
- func (c *Client) Click(win xproto.Window) error
- func (c *Client) FocusWindow(win xproto.Window) error
- func (c *Client) GetActiveWindow() (xproto.Window, error)
- func (c *Client) GetAllWindows() ([]xproto.Window, error)
- func (c *Client) GetChildWindows(win xproto.Window) ([]xproto.Window, error)
- func (c *Client) GetWindowClass(win xproto.Window) (string, error)
- func (c *Client) GetWindowPid(win xproto.Window) (uint32, error)
- func (c *Client) GetWindowSize(win xproto.Window) (uint16, uint16, error)
- func (c *Client) GetWindowTitle(win xproto.Window) (string, error)
- func (c *Client) GetWmName() string
- func (c *Client) GetWmSupported() ([]string, error)
- func (c *Client) GrabKey(key Key, win xproto.Window) error
- func (c *Client) GrabPointer(win xproto.Window) error
- func (c *Client) MoveWindow(win xproto.Window, x, y, w, h uint32) error
- func (c *Client) Poll(ctx context.Context, substructures bool) (<-chan XEvent, <-chan error, error)
- func (c *Client) RootWindow() xproto.Window
- func (c *Client) SendKeyDown(code xproto.Keycode, win xproto.Window, timestamp *xproto.Timestamp)
- func (c *Client) SendKeyPress(code xproto.Keycode, win xproto.Window, timestamp *xproto.Timestamp)
- func (c *Client) SendKeyUp(code xproto.Keycode, win xproto.Window, timestamp *xproto.Timestamp)
- func (c *Client) UngrabKey(key Key, win xproto.Window) error
- func (c *Client) UngrabPointer() error
- type FocusEvent
- type Key
- type KeyEvent
- type KeyState
- type Keymod
- type MoveEvent
- type XEvent
Constants ¶
const ( CHANNEL_SIZE = 256 ERROR_CHANNEL_SIZE = 8 )
const ( ModShift Keymod = 1 << 0 ModLock = 1 << 1 ModCtrl = 1 << 2 Mod1 = 1 << 3 Mod2 = 1 << 4 Mod3 = 1 << 5 Mod4 = 1 << 6 Mod5 = 1 << 7 ModNone = 0 )
const ( KeyBackspace xproto.Keycode = 22 KeyEnter xproto.Keycode = 104 KeyEscape xproto.Keycode = 9 KeyLeft xproto.Keycode = 113 KeyMinus xproto.Keycode = 20 KeyRight xproto.Keycode = 114 KeyTab xproto.Keycode = 23 KeyAlt xproto.Keycode = 64 KeyCtrl xproto.Keycode = 37 KeyShift xproto.Keycode = 50 KeyA xproto.Keycode = 38 KeyB xproto.Keycode = 56 KeyC xproto.Keycode = 54 KeyD xproto.Keycode = 40 KeyE xproto.Keycode = 26 KeyF xproto.Keycode = 41 KeyG xproto.Keycode = 42 KeyH xproto.Keycode = 43 KeyI xproto.Keycode = 31 KeyJ xproto.Keycode = 44 KeyK xproto.Keycode = 45 KeyL xproto.Keycode = 46 KeyM xproto.Keycode = 58 KeyN xproto.Keycode = 57 KeyO xproto.Keycode = 32 KeyP xproto.Keycode = 33 KeyQ xproto.Keycode = 24 KeyR xproto.Keycode = 27 KeyS xproto.Keycode = 39 KeyT xproto.Keycode = 28 KeyU xproto.Keycode = 30 KeyV xproto.Keycode = 55 KeyW xproto.Keycode = 25 KeyX xproto.Keycode = 53 KeyY xproto.Keycode = 29 KeyZ xproto.Keycode = 52 Key1 xproto.Keycode = 10 Key2 xproto.Keycode = 11 Key3 xproto.Keycode = 12 Key4 xproto.Keycode = 13 Key5 xproto.Keycode = 14 Key6 xproto.Keycode = 15 Key7 xproto.Keycode = 16 Key8 xproto.Keycode = 17 Key9 xproto.Keycode = 18 Key0 xproto.Keycode = 19 KeyF1 xproto.Keycode = 67 KeyF2 xproto.Keycode = 68 KeyF3 xproto.Keycode = 69 KeyF4 xproto.Keycode = 70 KeyF5 xproto.Keycode = 71 KeyF6 xproto.Keycode = 72 KeyF7 xproto.Keycode = 73 KeyF8 xproto.Keycode = 74 KeyF9 xproto.Keycode = 75 KeyF10 xproto.Keycode = 76 KeyF11 xproto.Keycode = 95 KeyF12 xproto.Keycode = 96 )
Variables ¶
var ErrDied = errors.New("connection closed")
Functions ¶
This section is empty.
Types ¶
type ButtonEvent ¶
func (ButtonEvent) Timestamp ¶
func (e ButtonEvent) Timestamp() xproto.Timestamp
type Client ¶ added in v0.4.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) FocusWindow ¶ added in v0.4.0
FocusWindow switches input focus to the given window. It does so by sending a message to the root window indicating that it should update the _NET_ACTIVE_WINDOW property. See: https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html
func (*Client) GetActiveWindow ¶ added in v0.4.0
GetActiveWindow returns the currently focused window.
func (*Client) GetAllWindows ¶ added in v0.4.0
GetAllWindows returns a list of all windows.
func (*Client) GetChildWindows ¶ added in v0.4.0
GetChildWindows returns a list of all children of the given window (and their children, and so on.)
func (*Client) GetWindowClass ¶ added in v0.4.0
GetWindowClass returns the WM_CLASS property of the given window.
func (*Client) GetWindowPid ¶ added in v0.4.0
GetWindowPid returns the process ID of the given window.
func (*Client) GetWindowSize ¶ added in v0.4.0
GetWindowSize returns the size of the given window.
func (*Client) GetWindowTitle ¶ added in v0.4.0
GetWindowTitle returns the title of the given window.
func (*Client) GetWmName ¶ added in v0.4.0
GetWmName returns the name of the window manager, if available.
func (*Client) GetWmSupported ¶ added in v0.4.0
GetWmSupported returns a list of the window manager's supported properties as defined by _NET_SUPPORTED.
func (*Client) GrabKey ¶ added in v0.4.0
GrabKey grabs a keyboard key from a window, diverting keypress events to resetti.
func (*Client) GrabPointer ¶ added in v0.4.0
GrabPointer grabs the mouse pointer from the given window.
func (*Client) MoveWindow ¶ added in v0.4.0
MoveWindow moves and resizes the given window.
func (*Client) Poll ¶ added in v0.4.0
Poll starts a separate goroutine which will listen for and forward various input events (keypresses, mouse movements, button presses).
func (*Client) RootWindow ¶ added in v0.4.0
RootWindow returns the ID of the root window.
func (*Client) SendKeyDown ¶ added in v0.4.0
SendKeyDown sends a key-down event with the given parameters. It increments the timestamp parameter by one to deal with a quirk of how GLFW handles key events.
See: https://github.com/glfw/glfw/blob/c18851f52ec9704eb06464058a600845ec1eada1/src/x11_window.c#L1250
func (*Client) SendKeyPress ¶ added in v0.4.0
SendKeyPress sends a key-down and key-up event with the given parameters. It increments the timestamp parameter by one to deal with a quirk of how GLFW handles key events (as described in SendKeyDown.)
In addition to the timestamp difference check, repeated presses of the same key must circumvent another check - the timestamp must have at least a 20ms difference. In cases where this is necessary, send an alternating sequence of the key you want to press and a dummy key (such as Control) that will trick GLFW.
See: https://github.com/glfw/glfw/blob/c18851f52ec9704eb06464058a600845ec1eada1/src/x11_window.c#L1321
func (*Client) SendKeyUp ¶ added in v0.4.0
SendKeyUp sends a key-up event with the given parameters.
Unlike SendKeyDown, it does *not* increment the timestamp parameter as GLFW's input handling does not require the timestamp to increase on key release events.
func (*Client) UngrabKey ¶ added in v0.4.0
UngrabKey releases a grabbed key and returns it back to the X server.
func (*Client) UngrabPointer ¶ added in v0.4.0
UngrabPointer returns the mouse pointer to the X server.
type FocusEvent ¶ added in v0.4.0
func (FocusEvent) Timestamp ¶ added in v0.4.0
func (e FocusEvent) Timestamp() xproto.Timestamp