Documentation
¶
Index ¶
- Constants
- type Atom
- type Config
- type Coord
- type Desktop
- type Event
- type EventQueue
- type InternedAtoms
- type KeyBind
- type KeyBinds
- type KeyboardMap
- type Rectangle
- type Root
- type Screen
- type WM
- type Window
- func (w *Window) Capture(wm *WM) (*image.RGBA, error)
- func (w *Window) GetGeometry(wm *WM) error
- func (w *Window) GetSupportedProtocols(wm *WM) error
- func (w *Window) Kill(wm *WM) error
- func (w *Window) Move(wm *WM, dx int32, dy int32) error
- func (w *Window) Resize(wm *WM, dx int32, dy int32) error
- func (w *Window) SetFullscreen(wm *WM) error
- func (w *Window) SetGeometry(wm *WM, rect Rectangle) error
- func (w *Window) SupportsProtocol(proto xproto.Atom) bool
- func (w *Window) ToggleFullscreen(wm *WM) error
- func (w *Window) UpdateGeometry(wm *WM, rect Rectangle) error
- type WindowList
- func (w *WindowList) Back() *Window
- func (w *WindowList) Front() *Window
- func (w *WindowList) Get(id xproto.Window) *Window
- func (w *WindowList) Has(id xproto.Window) bool
- func (w *WindowList) MoveBack(id xproto.Window) (bool, xproto.Window)
- func (w *WindowList) MoveFront(id xproto.Window) (bool, xproto.Window)
- func (w *WindowList) Pop(id xproto.Window) *Window
- func (w *WindowList) PopBack() *Window
- func (w *WindowList) PopFront() *Window
- func (w *WindowList) PushBack(ww Window)
- func (w *WindowList) PushFront(ww Window)
- type Workspace
- func (ws *Workspace) Activate(wm *WM) error
- func (ws *Workspace) Add(wm *WM, window Window) error
- func (ws *Workspace) AddNew(wm *WM, id xproto.Window) (*Window, error)
- func (ws *Workspace) Deactivate(wm *WM) error
- func (ws *Workspace) Focus(wm *WM, id xproto.Window) (bool, error)
- func (ws *Workspace) MoveBottom(wm *WM, id xproto.Window) bool
- func (ws *Workspace) MoveTop(wm *WM, id xproto.Window) bool
- func (ws *Workspace) Range(yield func(*Window) bool)
- func (ws *Workspace) RangeRev(yield func(*Window) bool)
Constants ¶
const ( // MouseModeGround indicates unset // mousemode (i.e. not selected). MouseModeGround = uint8(0) // MouseModeMove indicates mouse // currently being used to move window. MouseModeMove = uint8(1) // MouseModeResize indicates mouse // currently being used to resize window. MouseModeResize = uint8(2) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atom ¶
type Config ¶
type Config struct {
// MinWindowWidth is the minimum
// window width (px) to support.
MinWindowWidth uint32
// MinWindowHeight is the minimum
// window height (px) to support.
MinWindowHeight uint32
// ScreenPadding is the minimum px of windows
// to allow on-screen, and the default minimimum
// px from edges of newly spawned windows.
ScreenPadding uint32
// ModKey @TODO
ModKey uint16
// KeyBinds @TODO
KeyBinds KeyBinds
}
type Desktop ¶
type Desktop struct {
// Current
// workspace.
Current uint
// Contained workspaces.
Workspaces [9]Workspace
// The randr output
// this desktop is
// outputting to.
Screens []Screen
}
Desktop ...
func (*Desktop) GoTo ¶
GoTo will change the current workspace index to given, and toggle layout to redraw.
type Event ¶
type Event struct {
// Window is window
// acted on by event.
Window xproto.Window
// Event is actual
// wrapped X event.
Event xgb.XEvent
// contains filtered or unexported fields
}
Event wraps an XEvent to provide easy access to Window ID.
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
EventQueue is a doubly-linked list of Event objects.
func (*EventQueue) PopBy ¶
func (eq *EventQueue) PopBy(id xproto.Window) *Event
PopBy pops the first Event with given ID from queue, or returns nil.
func (*EventQueue) Push ¶
func (l *EventQueue) Push(elem *Event)
Push pushes the given event to the back of the queue.
type InternedAtoms ¶
type InternedAtoms struct {
Atom Atom
Supported Atom
WMDeleteWindow Atom
WMProtocols Atom
WMWindowType Atom
WMWindowTypeNormal Atom
WMWindowTypeDialog Atom
WMWindowTypeToolbar Atom
WMWindowTypeMenu Atom
WMWindowTypePopupMenu Atom
WMWindowTypeDropdownMenu Atom
WMWindowTypeUtility Atom
WMWindowTypeSplash Atom
WMState Atom
}
InternedAtoms is a structure of required interned atoms.
func (*InternedAtoms) InternAll ¶
func (ia *InternedAtoms) InternAll(wm *WM) error
InternAll interns all of the atoms contained within InternedAtoms.
type KeyBind ¶
type KeyBind struct {
// Mods ...
Mods uint16
// Key ...
Key xproto.Keysym
// Func ...
Func func(wm *WM, selected *Window) error
}
KeyBind ...
type KeyboardMap ¶
type KeyboardMap struct {
// contains filtered or unexported fields
}
KeyboardMap stores a map of X keycodes to possible keysyms.
func (*KeyboardMap) GetKeycode ¶
func (km *KeyboardMap) GetKeycode(ks xproto.Keysym) []xproto.Keycode
GetKeycode fetches a mapped list of possible keycodes for given keysym.
func (*KeyboardMap) GetKeysym ¶
func (km *KeyboardMap) GetKeysym(kc xproto.Keycode) xproto.Keysym
GetKeysym fetches the keysym mapped to provided keycode.
func (*KeyboardMap) Update ¶
func (km *KeyboardMap) Update(kmin xproto.Keycode, kbmap xproto.GetKeyboardMappingReply)
Update will update the keyboard mappings stored with the values in provided reply.
type Rectangle ¶
type Rectangle struct {
Coord
// Width in pixels
// from Coord{X,Y}.
Width uint32
// Height in pixels
// from Coord{X,Y}.
Height uint32
}
func (Rectangle) Contains ¶
Contains returns whether receiving rectangle contains the given coords, given the total containing root rectangle.
type WM ¶
type WM struct {
// Configuration data.
Config Config
// Desktop ...
Desktop Desktop
// Root window.
Root Root
// Interned X atoms.
Atoms InternedAtoms
// Last mouse pos + mode.
LastMouse Coord
MouseMode uint8
// Currrently selected X window.
Selected xproto.Window
// Map of keycodes
// to keyboard syms.
KBMap KeyboardMap
// XSetup contains X
// connection setup info.
XSetup *xproto.SetupInfo
// EvQueue stores queued events
// for windows not yet mapped
EvQueue EventQueue
// XConn is underlying
// X server connection.
XConn *xgb.XConn
// XProp provides xprop
// conn helper methods.
XProp *xprop.XPropConn
}
type Window ¶
type Window struct {
// X window ID.
ID xproto.Window
// Represented by
// a rectangle.
Rectangle
Workspace *Workspace
// Protocols is the list of
// protocols this window supports.
Protocols []xproto.Atom
// Tracks Window
// fullscreen status.
Fullscreen bool
}
func CreateWindow ¶
CreateWindow attemps to create and populate a Window object for given X window ID.
func (*Window) Capture ¶
Capture will return an RGBA image object representing the current image of this window on-display.
func (*Window) GetGeometry ¶
GetGeometry fetches updated geometry from X.
func (*Window) GetSupportedProtocols ¶
GetSupportedProtocols fetches the supported WM protocols for this w.
func (*Window) SetFullscreen ¶
SetFullscreen sets the window as fullscreen updating the relevant flag, and sending a configure window request to X with current root window dimensions.
func (*Window) SetGeometry ¶
SetGeometry will bound check the given geometry against current configuration and root window dimensions, then send a configure window request to X with updatee dimensions.
func (*Window) SupportsProtocol ¶
SupportsProtocol returns whether this window supports given X protocol.
func (*Window) ToggleFullscreen ¶
ToggleFullscreen toggles the window's fullscreen status.
type WindowList ¶
type WindowList struct {
W []Window
}
Windows represents a list of windows.
func (*WindowList) Back ¶
func (w *WindowList) Back() *Window
Back fetches the Window at the back of the list.
func (*WindowList) Front ¶
func (w *WindowList) Front() *Window
Front fetches the Window at the front of the list.
func (*WindowList) Get ¶
func (w *WindowList) Get(id xproto.Window) *Window
Get will fetch the Window with ID.
func (*WindowList) Has ¶
func (w *WindowList) Has(id xproto.Window) bool
Has checks if Windows contains a Window with ID.
func (*WindowList) MoveBack ¶
MoveFront attempts to move window with ID to front of stack, returning bool success state and ID of the previous front window if move occurred.
func (*WindowList) MoveFront ¶
MoveFront attempts to move window with ID to front of stack, returning bool success state and ID of the previous front window if move occurred.
func (*WindowList) Pop ¶
func (w *WindowList) Pop(id xproto.Window) *Window
Pop will attempt to remove Window with ID from the list.
func (*WindowList) PopBack ¶
func (w *WindowList) PopBack() *Window
PopBack will remove the Window from the back of the list.
func (*WindowList) PopFront ¶
func (w *WindowList) PopFront() *Window
PopFront will remove the Window from the front of the list.
func (*WindowList) PushBack ¶
func (w *WindowList) PushBack(ww Window)
PushBack will add the supplied Window to the back of the list.
func (*WindowList) PushFront ¶
func (w *WindowList) PushFront(ww Window)
PushFront will add the supplied Window to the front of the list.
type Workspace ¶
type Workspace struct{ WindowList }
Workspace represents a single workspace of windows.