window

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {

	// ActiveWindowTitle returns the currently active window's title.
	ActiveWindowTitle() string

	// DetectWindowTitleChanges blocks and starts detecting changes in window
	// titles. When a change is detected, the onChange function is called and
	// when a non-fatal error occurs the onError function is called for that
	// error.
	DetectWindowTitleChanges(onChange func(), onError func(error)) error
}

API defines the functions necessary to monitor window activity.

type X11

type X11 struct {
	// This is the underlying X11 connection.
	XConnection *xgb.Conn

	// This is the root window.
	RootWindow xproto.Window

	// The value of this atom should be the currently active window identifier.
	// NOTE: Sometimes there is no currently active window.
	ActiveWindowAtom xproto.Atom

	// This is the canonical window title atom. When the value for it is
	// retrieved, it should always return the current real window title.
	WindowNameAtom xproto.Atom

	// This is a common window title atom. Any changes that occur for it may
	// indicate the title has been updated.
	WindowName2Atom xproto.Atom

	// This is another common window title atom. Any changes that occur for it
	// may indicate the title has been updated.
	WindowName3Atom xproto.Atom
}

X11 creates and manages the currently active X11 connection.

func NewX11

func NewX11() (*X11, error)

NewX11 starts up a new connection to an X11 display server, interning all necessary atoms up front and setting up the root window.

func (X11) ActiveWindowTitle

func (x11 X11) ActiveWindowTitle() string

ActiveWindowTitle returns the currently active window title or an empty string if one is not available.

func (X11) DetectWindowTitleChanges

func (x11 X11) DetectWindowTitleChanges(onChange func(), onError func(error)) error

DetectWindowTitleChanges blocks and starts detecting changes in window titles. When a change is detected, the onChange function is called and when a non-fatal error occurs the onError function is called for that error.

Jump to

Keyboard shortcuts

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