Documentation
¶
Overview ¶
frame is the package that contains the definition of the tree window structure and decoration handling that drives rowm.
place.go - entrypoint for when a new window is created either standalone or as part of a split frame.go - defines the tree structure and traversal of windows container.go - defines the resizing, minimizing, and moving of a window tree as wrapped by decorations context.go - all non trivial state is stored in the context, and is available to most operations config.go - store of all user defined settings decoration.go - utilities for decorations (non user created windows) pieces.go - definitions of individual decorations and their callbacks which make up a container taskbar.go - a taskbar decoration for displaying basic system information and showing open windows anchor.go - utilities for defining screen anchors (preset shapes on a screen you can hotkey to) background.go - utilities for generating backgrounds rect.go - a basic rectangle definition for describing window shapes and locations
Index ¶
- Variables
- func AddWindowHook(ctx *Context, window xproto.Window) error
- func AreaOfIntersection(shapeA, shapeB Rect) int
- func CalcCanFit(ctx *Context) int
- func DisplayBackground(im *xgraphics.Image, x, y int) *xwindow.Window
- func GenerateBackgrounds(ctx *Context) error
- func GeneratePieces(ctx *Context, c *Container) error
- func HomeDir() string
- func ShouldActivate(idx int, start int, canfit int) bool
- type AnchorType
- type AttachTarget
- type Config
- type Container
- func (c *Container) ActiveRoot() *Frame
- func (c *Container) AddBottomHook(ctx *Context)
- func (c *Container) AddBottomLeftHook(ctx *Context)
- func (c *Container) AddBottomRightHook(ctx *Context)
- func (c *Container) AddCloseHook(ctx *Context) error
- func (c *Container) AddGrabHook(ctx *Context)
- func (c *Container) AddLeftHook(ctx *Context)
- func (c *Container) AddMaximizeHook(ctx *Context) error
- func (c *Container) AddMinimizeHook(ctx *Context) error
- func (c *Container) AddRightHook(ctx *Context)
- func (c *Container) AddTopHook(ctx *Context)
- func (c *Container) AddTopLeftHook(ctx *Context)
- func (c *Container) AddTopRightHook(ctx *Context)
- func (c *Container) ChangeMinimizationState(ctx *Context)
- func (c *Container) Destroy(ctx *Context)
- func (c *Container) Map()
- func (c *Container) MoveResize(ctx *Context, x, y, w, h int)
- func (c *Container) MoveResizeShape(ctx *Context, shape Rect)
- func (c *Container) Raise(ctx *Context)
- func (c *Container) RaiseFindFocus(ctx *Context)
- func (c *Container) RestingShape(ctx *Context, screen Rect) Rect
- func (c *Container) UpdateFrameMappings(ctx *Context)
- type ContainerDecorations
- type Context
- func (ctx *Context) DefaultShapeForScreen(screen Rect) Rect
- func (ctx *Context) DetectScreensChange() (bool, []Rect, error)
- func (ctx *Context) GenerateLockPrompt()
- func (c *Context) Get(w xproto.Window) *Frame
- func (ctx *Context) GetFocusedFrame() *Frame
- func (ctx *Context) GetScreenForShape(shape Rect) (Rect, int, int)
- func (ctx *Context) LastFocusedScreen() Rect
- func (ctx *Context) LowerLock()
- func (ctx *Context) RaiseLock()
- func (ctx *Context) SetLocked(state bool)
- func (ctx *Context) UpdateScreens()
- type Decoration
- type DragOrigin
- type Element
- type ElementScroller
- func (es *ElementScroller) AddSlideHooks(ctx *Context) error
- func (es *ElementScroller) ForEach(f func(*Element, int))
- func (es *ElementScroller) Get(c *Container) *Element
- func (es *ElementScroller) Lower(ctx *Context)
- func (es *ElementScroller) MoveResize(ctx *Context)
- func (es *ElementScroller) Raise(ctx *Context)
- func (es *ElementScroller) ShiftAndActivate(ctx *Context)
- func (es *ElementScroller) SlideLeft(ctx *Context)
- func (es *ElementScroller) SlideRight(ctx *Context)
- func (es *ElementScroller) UpdateMappings(ctx *Context)
- type Frame
- func (f *Frame) CalcShape(ctx *Context) Rect
- func (f *Frame) Close(ctx *Context)
- func (f *Frame) CreateSeparatorDecoration(ctx *Context)
- func (f *Frame) Destroy(ctx *Context)
- func (f *Frame) Find(fun func(*Frame) bool) *Frame
- func (f *Frame) FindNearest(fun func(*Frame) bool) *Frame
- func (f *Frame) FindNextLeaf(fun func(*Frame) bool, reversed bool, root *Frame) *Frame
- func (f *Frame) Focus(ctx *Context)
- func (f *Frame) FocusRaise(ctx *Context)
- func (f *Frame) GetLeftmostFrameInSubtree() *Frame
- func (f *Frame) GetRightmostFrameInSubtree() *Frame
- func (f *Frame) IsLeaf() bool
- func (f *Frame) IsOrphan() bool
- func (f *Frame) IsRoot() bool
- func (f *Frame) Isolate(ctx *Context)
- func (f *Frame) Map()
- func (f *Frame) MoveResize(ctx *Context)
- func (f *Frame) Orphan(ctx *Context)
- func (f *Frame) Raise(ctx *Context)
- func (f *Frame) RaiseDecoration(ctx *Context)
- func (f *Frame) Root() *Frame
- func (f *Frame) SeparatorShape(ctx *Context) Rect
- func (f *Frame) Traverse(fun func(*Frame))
- func (f *Frame) Unmap(ctx *Context)
- func (f *Frame) UnmapSingle(ctx *Context)
- type History
- type Partition
- type PartitionType
- type Rect
- func AnchorShape(ctx *Context, screen Rect, anchor AnchorType) Rect
- func BarrierElementShape(ctx *Context) Rect
- func BatShape(ctx *Context) Rect
- func BottomLeftShape(context *Context, cShape Rect) Rect
- func BottomRightShape(context *Context, cShape Rect) Rect
- func BottomShape(context *Context, cShape Rect) Rect
- func CloseShape(context *Context, cShape Rect) Rect
- func ContainerShapeFromRoot(ctx *Context, fShape Rect) Rect
- func ElementShape(ctx *Context, indexOffset int) Rect
- func GrabShape(context *Context, cShape Rect) Rect
- func LeftSelectorShape(ctx *Context) Rect
- func LeftShape(context *Context, cShape Rect) Rect
- func MaximizeShape(context *Context, cShape Rect) Rect
- func MinWinShape(ctx *Context, elementShape Rect) Rect
- func MinimizeShape(context *Context, cShape Rect) Rect
- func RightSelectorShape(ctx *Context) Rect
- func RightShape(context *Context, cShape Rect) Rect
- func RootShape(ctx *Context, c *Container) Rect
- func TaskbarShape(ctx *Context) Rect
- func TimeShape(ctx *Context) Rect
- func TopLeftShape(context *Context, cShape Rect) Rect
- func TopRightShape(context *Context, cShape Rect) Rect
- func TopShape(context *Context, cShape Rect) Rect
- type Rectf
- type StringWithHelp
- type Taskbar
- func (t *Taskbar) Lower(ctx *Context)
- func (t *Taskbar) MoveResize(ctx *Context)
- func (t *Taskbar) Raise(ctx *Context)
- func (t *Taskbar) RemoveContainer(ctx *Context, c *Container)
- func (t *Taskbar) Update(ctx *Context)
- func (t *Taskbar) UpdateContainer(ctx *Context, c *Container)
- func (t *Taskbar) UpdateMapping(ctx *Context)
- type Yank
Constants ¶
This section is empty.
Variables ¶
var NoFont = xgraphics.MustFont(xgraphics.ParseFont( bytes.NewBuffer(misc.DataFile("write-your-password-with-this-font.ttf"))))
NoFont is a font where all the characters are a circle. This is because I am lazy and didn't want to modify the wingo prompt for password related stuff, so instead we show passwords with a uniform font.
Functions ¶
func AddWindowHook ¶
AddWindowHook registers callbacks for window related events.
func AreaOfIntersection ¶
func CalcCanFit ¶
func DisplayBackground ¶
Modified from github.com/BurntSushi/xgbutil/xgraphics XShowExtra
func GenerateBackgrounds ¶
func GeneratePieces ¶
Types ¶
type AnchorType ¶
type AnchorType int
const ( NONE AnchorType = iota FULL TOP LEFT RIGHT BOTTOM )
func AnchorMatch ¶
func AnchorMatch(ctx *Context, screen Rect, shape Rect) AnchorType
type AttachTarget ¶
type AttachTarget struct {
Target *Frame
Type PartitionType
}
type Config ¶
type Config struct {
Shell string
Lock string
TabByFrame bool
TabForward StringWithHelp
TabBackward StringWithHelp
ButtonDrag string
ButtonClick string
SplitVertical StringWithHelp
SplitHorizontal StringWithHelp
RunCmd StringWithHelp
Shutdown string
CloseFrame StringWithHelp
ToggleExpandFrame StringWithHelp
ToggleExternalDecorator string
ToggleTaskbar string
PopFrame StringWithHelp
ResetSize string
Minimize string
WindowUp StringWithHelp
WindowDown StringWithHelp
WindowLeft StringWithHelp
WindowRight StringWithHelp
VolumeUp string
VolumeDown string
BrightnessUp string
BrightnessDown string
Backlight string
VolumeMute string
FocusNext StringWithHelp
FocusPrev StringWithHelp
ElemSize int
CloseCursor int
DefaultShapeRatio Rectf
SeparatorColor uint32
GrabColor uint32
FocusColor uint32
CloseColor uint32
MaximizeColor uint32
MinimizeColor uint32
ResizeColor uint32
TaskbarBaseColor uint32
TaskbarTextColor uint32
InternalPadding int
BackgroundImagePath string
BuiltinCommands map[StringWithHelp]string
FocusMarkerTime time.Duration
DoubleClickTime time.Duration
TaskbarHeight int
TaskbarSlideWidth int
TaskbarSlideActiveColor uint32
TaskbarSlideInactiveColor uint32
TaskbarFontSize float64
TaskbarTimeBaseColor uint32
TaskbarXPad int
TaskbarYPad int
TaskbarTimeFormat string
TaskbarBatFormat string
TaskbarElementShape Rect
TaskbarMinMaxHeight int
TaskbarMinMaxColor uint32
TaskbarSlideLeft string
TaskbarSlideRight string
CutSelectFrame string
CutSelectContainer string
CopySelectHorizontal StringWithHelp
CopySelectVertical StringWithHelp
SuspendCommand string
BatteryWarningLevels []int
BatteryWarningDuration time.Duration
LaunchHelp string
GotoKeys map[string]string
}
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig reference for key strings https://github.com/BurntSushi/xgbutil/blob/master/keybind/keysymdef.go
func (*Config) BrightFile ¶
func (*Config) MaxBrightFile ¶
type Container ¶
type Container struct {
Shape Rect
Root *Frame
Expanded *Frame
DragContext DragOrigin
Decorations ContainerDecorations
Hidden bool
LastUnanchoredShape Rect
LastGrabTime time.Time
}
Container represents the wrapping decorations around a frame tree. It keeps track of size, position, and minimzation state for the tree.
func (*Container) ActiveRoot ¶
func (*Container) AddBottomHook ¶
func (*Container) AddBottomLeftHook ¶
func (*Container) AddBottomRightHook ¶
func (*Container) AddCloseHook ¶
func (*Container) AddGrabHook ¶
func (*Container) AddLeftHook ¶
func (*Container) AddMaximizeHook ¶
func (*Container) AddMinimizeHook ¶
func (*Container) AddRightHook ¶
func (*Container) AddTopHook ¶
func (*Container) AddTopLeftHook ¶
func (*Container) AddTopRightHook ¶
func (*Container) ChangeMinimizationState ¶
func (*Container) MoveResize ¶
func (*Container) MoveResizeShape ¶
func (*Container) RaiseFindFocus ¶
func (*Container) RestingShape ¶
Returns the last shape the container had when it was unanchored
func (*Container) UpdateFrameMappings ¶
type ContainerDecorations ¶
type ContainerDecorations struct {
Hidden bool
Close, Maximize, Minimize, Grab Decoration
Top, Left, Bottom, Right Decoration
TopRight, TopLeft, BottomRight, BottomLeft Decoration
}
func (*ContainerDecorations) Destroy ¶
func (cd *ContainerDecorations) Destroy(ctx *Context)
func (*ContainerDecorations) ForEach ¶
func (cd *ContainerDecorations) ForEach(f func(*Decoration))
func (*ContainerDecorations) Map ¶
func (cd *ContainerDecorations) Map()
func (*ContainerDecorations) MoveResize ¶
func (cd *ContainerDecorations) MoveResize(ctx *Context, cShape Rect)
func (*ContainerDecorations) Unmap ¶
func (cd *ContainerDecorations) Unmap()
type Context ¶
type Context struct {
X *xgbutil.XUtil // The connection to X
AttachPoint *AttachTarget // The frame to split when adding the next window (if any)
Yanked *Yank // The window or container selected to transfer (if any)
Tracked map[xproto.Window]*Frame // All known user windows
UnmapCounter map[xproto.Window]int // Tracking of unmap notifications to distinguish internal from external
Containers map[*Container]struct{} // All known containers
Cursors map[int]xproto.Cursor // X cursor cache
DummyIcon *xgraphics.Image // Icon to use for no icon
Backgrounds map[xproto.Window]*xwindow.Window // Background windows
Config Config // All user provided preferences
Screens []Rect // All heads (aka monitors) and their shapes
LastKnownFocused xproto.Window // Last window we knew of that had input focus
LastKnownFocusedScreen int // Last screen/head/monitor that had a focused window that we know of
SplitPrompt *prompt.Input // Prompt for splitting windows (if any active)
Locked bool // Whether we should be in a lock screen
LockPrompt *prompt.Input // Prompt for unlocking screen (if any)
Taskbar *Taskbar // The taskbar, doesn't need a comment but it felt lonely
FocusMarker *xwindow.Window // Marker for recently focused windows when cycling
LastLockChange time.Time // Last time we went from locked->unlocked or reverse
Injector *sideloop.Injector // Utility for inserting work between X events
Gotos map[string]xproto.Window // Mapping of shortcut minimize/focus keys for windows
}
Context represents all non-trivial state stored by the window manager.
func NewContext ¶
NewContext will create a new context but also populate screen backgrounds, create the taskbar, and generate the cursor cache
func (*Context) DefaultShapeForScreen ¶
func (*Context) DetectScreensChange ¶
func (*Context) GenerateLockPrompt ¶
func (ctx *Context) GenerateLockPrompt()
func (*Context) GetFocusedFrame ¶
func (*Context) GetScreenForShape ¶
func (*Context) LastFocusedScreen ¶
func (*Context) UpdateScreens ¶
func (ctx *Context) UpdateScreens()
type Decoration ¶
func CreateDecoration ¶
func (*Decoration) MoveResize ¶
func (d *Decoration) MoveResize(r Rect)
type DragOrigin ¶
func GenerateDragContext ¶
func GenerateDragContext(ctx *Context, c *Container, f *Frame, mouseX, mouseY int) DragOrigin
type Element ¶
type Element struct {
Container *Container
Window *xwindow.Window
MinWin *xwindow.Window
Prev, Next *Element
Active bool
}
func (*Element) AddIconHooks ¶
func (*Element) MoveResize ¶
func (*Element) UpdateMapping ¶
type ElementScroller ¶
type ElementScroller struct {
Elements map[*Container]*Element
Back *Element
Front *Element
StartingIdx int
CanFit int
ShiftLeftInactive, ShiftRightInactive *xwindow.Window
ShiftLeftActive, ShiftRightActive *xwindow.Window
}
func NewElementScroller ¶
func NewElementScroller(ctx *Context) *ElementScroller
func (*ElementScroller) AddSlideHooks ¶
func (es *ElementScroller) AddSlideHooks(ctx *Context) error
func (*ElementScroller) ForEach ¶
func (es *ElementScroller) ForEach(f func(*Element, int))
func (*ElementScroller) Get ¶
func (es *ElementScroller) Get(c *Container) *Element
func (*ElementScroller) Lower ¶
func (es *ElementScroller) Lower(ctx *Context)
func (*ElementScroller) MoveResize ¶
func (es *ElementScroller) MoveResize(ctx *Context)
func (*ElementScroller) Raise ¶
func (es *ElementScroller) Raise(ctx *Context)
func (*ElementScroller) ShiftAndActivate ¶
func (es *ElementScroller) ShiftAndActivate(ctx *Context)
func (*ElementScroller) SlideLeft ¶
func (es *ElementScroller) SlideLeft(ctx *Context)
func (*ElementScroller) SlideRight ¶
func (es *ElementScroller) SlideRight(ctx *Context)
func (*ElementScroller) UpdateMappings ¶
func (es *ElementScroller) UpdateMappings(ctx *Context)
type Frame ¶
type Frame struct {
Shape Rect
Window *xwindow.Window
Container *Container
Parent, ChildA, ChildB *Frame
Separator Partition
Mapped bool
}
Frame represents a node in the tree like structure of panels in each container. A frame can either be a leaf node, which has a user created window to display, or it can display a seperator decoration that allows the resizing of its child frames.
func AttachWindow ¶
func (*Frame) CalcShape ¶
CalcShape returns the shape a frame should be based off of its container and parent
func (*Frame) CreateSeparatorDecoration ¶
func (*Frame) Find ¶
Find will find the first frame that fulfills the predicate and is a descendent of the input frame.
func (*Frame) FindNearest ¶
FindNearest will run BFS on the tree the input frame is in to find a frame that fulfills the predicate.
func (*Frame) FindNextLeaf ¶
FindNext will find the next (top down, left to right) leaf element in the tree that fulfills a predicate You can provide a root frame which will constrain the search to a subtree, must be a parent of f or nil If reversed, it will go backwards through the tree
func (*Frame) FocusRaise ¶
func (*Frame) GetLeftmostFrameInSubtree ¶
Returns the first node in a subtree, root must be a parent of f or nil
func (*Frame) GetRightmostFrameInSubtree ¶
Returns the last node in a subtree, root must be a parent of f or nil
func (*Frame) MoveResize ¶
MoveResize will cascade down changes in shape down the tree.
func (*Frame) Orphan ¶
Orphan removes a frame from its container and reorganizes the tree to fill the gap.
func (*Frame) RaiseDecoration ¶
func (*Frame) SeparatorShape ¶
func (*Frame) UnmapSingle ¶
type Partition ¶
type Partition struct {
Ratio float64
Type PartitionType
Decoration Decoration
}
type Rect ¶
func AnchorShape ¶
func AnchorShape(ctx *Context, screen Rect, anchor AnchorType) Rect
func BarrierElementShape ¶
func BottomLeftShape ¶
func BottomRightShape ¶
func BottomShape ¶
func CloseShape ¶
func ContainerShapeFromRoot ¶
func ElementShape ¶
func LeftSelectorShape ¶
func MaximizeShape ¶
func MinWinShape ¶
func MinimizeShape ¶
func RightSelectorShape ¶
func RightShape ¶
func TaskbarShape ¶
func TopLeftShape ¶
func TopRightShape ¶
func (*Rect) ToImageRect ¶
type StringWithHelp ¶
type Taskbar ¶
type Taskbar struct {
Base Decoration
TimeWin *xwindow.Window
BatWin *xwindow.Window
Hidden bool
Scroller *ElementScroller
History History
}