layout

package
v0.0.0-...-c3f8d49 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Border

type Border struct {
	Geometry wlc.Geometry
}

Border defines a view border. TODO: implement.

type Container

type Container interface {
	// Geometry of the container.
	Geometry() *wlc.Geometry

	// Children of the container.
	Children() []Container

	// Floating children of the container.
	Floating() []Container

	// Focused child of the container.
	Focused() Container

	// Parent of the container.
	Parent() Container

	// Visible returns true if the container is visible.
	Visible() bool

	// AddChild adds a child container.
	AddChild(Container)

	// Type returns the type of a container.
	Type() ContainerType
}

Container defines an interface describing a container e.g. output, workspace or view.

type ContainerType

type ContainerType int

ContainerType is a type of container e.g. Root or Output.

const (
	// CRoot is the root container type.
	CRoot ContainerType = iota
	// COutput is the output container type.
	COutput
	// CWorkspace is the workspace container type.
	CWorkspace
	// CView is the view container type.
	CView
)

type Direction

type Direction int

Direction defines a movement direction in a layout.

const (
	// Up is direction up.
	Up Direction = iota
	// Down is direction down.
	Down
	// Left is direction left.
	Left
	// Right is direction right.
	Right
)

type Layout

type Layout interface {
	// Move container in direction.
	Move(ctx context.Context, dir Direction)

	// Focus container.
	Focus(ctx context.Context, container Container)

	// Focused returns the focused container of the layout.
	Focused(ctx context.Context) Container

	FocusedByType(ctx context.Context, typ ContainerType) Container

	// NewOuput initializes a new output.
	NewOutput(ctx context.Context, output backend.Output)

	// NewWorkspace initializes a new workspace.
	NewWorkspace(ctx context.Context, output *Output, name string, num uint)

	// NewView initializes a new view.
	NewView(ctx context.Context, view backend.View)

	// ArrangeRoot arranges the whole layout from the root and down.
	ArrangeRoot()

	// Arrange arranges a subbranch of the layout starting from the
	// specified container and moving down the layout.
	Arrange(start Container)
}

Layout defines an interface for interacting with a layout.

func Get

func Get(ctx context.Context) Layout

Get layout from context.

type Mock

type Mock struct{}

Mock mocks the layout interface.

func (Mock) Arrange

func (m Mock) Arrange(start Container)

Arrange mocks arranging a subbranch of the layout starting from the specified container and moving down the layout.

func (Mock) ArrangeRoot

func (m Mock) ArrangeRoot()

ArrangeRoot mocks arranging the whole layout from the root and down.

func (Mock) Focus

func (m Mock) Focus(ctx context.Context, container Container)

Focus mocks focusing a container.

func (Mock) Focused

func (m Mock) Focused(ctx context.Context) Container

Focused mocks returning the focused container of the layout.

func (Mock) FocusedByType

func (m Mock) FocusedByType(ctx context.Context, typ ContainerType) Container

FocusedByType mocks returning a focused container by type.

func (Mock) Move

func (m Mock) Move(ctx context.Context, dir Direction)

Move mocks moving container in direction.

func (Mock) NewOutput

func (m Mock) NewOutput(ctx context.Context, output backend.Output)

NewOutput mocks initializing a new output.

func (Mock) NewView

func (m Mock) NewView(ctx context.Context, view backend.View)

NewView mocks initializing a new view.

func (Mock) NewWorkspace

func (m Mock) NewWorkspace(ctx context.Context, output *Output, name string, num uint)

NewWorkspace mocks initializing a new workspace.

type Output

type Output struct {
	backend.Output
	// contains filtered or unexported fields
}

Output describes an output in the layout.

func NewOutput

func NewOutput(output backend.Output, root *Root) *Output

NewOutput initializes a new empty output.

func (*Output) AddChild

func (o *Output) AddChild(workspace Container)

AddChild adds a workspace to the output.

func (*Output) Children

func (o *Output) Children() []Container

Children returns a list of workspaces attached to the output.

func (*Output) Floating

func (o *Output) Floating() []Container

Floating returns nil because an output can't have any floating children.

func (*Output) Focused

func (o *Output) Focused() Container

Focused returns the focused child container of the output.

func (*Output) Geometry

func (o *Output) Geometry() *wlc.Geometry

Geometry returns the geometry of the output.

func (*Output) Parent

func (o *Output) Parent() Container

Parent returns the root container.

func (*Output) Type

func (o *Output) Type() ContainerType

Type returns the output container type.

func (*Output) Visible

func (o *Output) Visible() bool

Visible return true if the output is visible. Currently an output can only be visible.

type Root

type Root struct {
	// contains filtered or unexported fields
}

Root is the root container in a layout. The root container manages the output containers.

func NewRoot

func NewRoot() *Root

NewRoot initializes a new empty root container.

func (*Root) AddChild

func (r *Root) AddChild(output Container)

AddChild adds an output to the root container.

func (*Root) Children

func (r *Root) Children() []Container

Children returns a list for output containers attached to the root container.

func (*Root) Floating

func (r *Root) Floating() []Container

Floating always returns nil because the root container can't have floating child containers.

func (*Root) Focused

func (r *Root) Focused() Container

Focused returns the focused output container.

func (*Root) Geometry

func (r *Root) Geometry() *wlc.Geometry

Geometry returns the root container geometry which is always nil.

func (*Root) Parent

func (r *Root) Parent() Container

Parent returns nil because the root container has no parents.

func (*Root) SortedWorkspaces

func (r *Root) SortedWorkspaces() []*Workspace

SortedWorkspaces returns an aggregated sorted list of workspaces on all outputs.

func (*Root) Type

func (r *Root) Type() ContainerType

Type returns the root container type.

func (*Root) Visible

func (r *Root) Visible() bool

Visible returns true if the container is visible. The root container is always visible.

type View

type View struct {
	backend.View

	Border *Border
	// contains filtered or unexported fields
}

View defines a view in the layout.

func NewView

func NewView(backend backend.View, parent Container) *View

NewView initializes a new view container.

func (*View) AddChild

func (v *View) AddChild(_ Container)

AddChild is a no-op function since views can't have any children.

func (*View) Children

func (v *View) Children() []Container

Children returns nil since a view doesn't have any children.

func (*View) Floating

func (v *View) Floating() []Container

Floating returns nil since a view doesn't have any floating children.

func (*View) Focused

func (v *View) Focused() Container

Focused returns a pointer to itself if it's focused.

func (*View) Fullscreen

func (v *View) Fullscreen() bool

Fullscreen returns true if view is in fullscreen mode.

func (*View) Geometry

func (v *View) Geometry() *wlc.Geometry

Geometry returns the view geometry. TODO: with or without border?

func (*View) Parent

func (v *View) Parent() Container

Parent returns the parent container of the view.

func (*View) SetVisible

func (v *View) SetVisible(visible bool)

SetVisible sets the visibility state of the view.

func (*View) Type

func (v *View) Type() ContainerType

Type returns the view container type.

func (*View) Visible

func (v *View) Visible() bool

Visible returns true if the view is visible. The parent container must be visible for the view to be visible.

type Workspace

type Workspace struct {
	Num uint
	// contains filtered or unexported fields
}

Workspace is a workspace container in the layout. A workspace has a list of tiled containers plus a list of floating containers associated with it.

func NewWorkspace

func NewWorkspace(name string, num uint, output *Output) *Workspace

NewWorkspace initializes a new empty workspace container.

func (*Workspace) AddChild

func (w *Workspace) AddChild(container Container)

AddChild adds a child container to the workspace.

func (*Workspace) Children

func (w *Workspace) Children() []Container

Children returns a list of (non-floating) containers on the workspace.

func (*Workspace) Floating

func (w *Workspace) Floating() []Container

Floating returns a list of floating containers on the workspace.

func (*Workspace) Focused

func (w *Workspace) Focused() Container

Focused returns the focused child container of the workspace.

func (*Workspace) Geometry

func (w *Workspace) Geometry() *wlc.Geometry

Geometry for the workspace is the geometry of the parent output.

func (*Workspace) Name

func (w *Workspace) Name() string

Name return the name of the workspace.

func (*Workspace) Parent

func (w *Workspace) Parent() Container

Parent returns the parent output of the workspace.

func (*Workspace) Type

func (w *Workspace) Type() ContainerType

Type returns the workspace container type.

func (*Workspace) Visible

func (w *Workspace) Visible() bool

Visible returns true if workspace is visible.

type Workspaces

type Workspaces []*Workspace

Workspaces is a list of workspaces.

func (Workspaces) Len

func (w Workspaces) Len() int

Len returns the length of the workspace list.

func (Workspaces) Less

func (w Workspaces) Less(i, j int) bool

Less returns true if workspace at index i should be sorted before workspace at index j.

func (Workspaces) Swap

func (w Workspaces) Swap(i, j int)

Swap swaps two workspaces in the workspace list.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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