Documentation ¶
Overview ¶
Package workspace is responsible for maintaining the state for the workspaces used in Wingo. It's responsible for showing or hiding a workspace, activating a workspace, adding/removing workspaces, adding clients to workspaces, and managing the state of all layouts for each workspace.
Heads ¶
Most of the invariants surrounding attached physical heads are maintained in the heads package. Chief among these invariants: 1) There must be at least as many workspaces as there are heads. 2) There must be precisely N visible workspaces where N is the number of active physical heads. 3) There must always be one and only one active workspace.
The heads package maintains these invariants by 1) adding workspaces when there aren't enough, 2) showing/hiding workspaces as appropriate the number of active physical heads has changed, and 3) checking to make sure one workspace is active after the number of physical heads has changed and being the only one responsible for "switching" workspaces.
Namely, information about which workspace is active and which are visible/hidden is maintained in the heads package.
Layout ¶
Every layout is responsible for maintaining a list of clients that *may* use that particular layout to be placed. In essence, this allows quick access to all clients in a particular layout for a single workspace.
The list contains clients that *may* be in the particular layout because a client's layout is determined by two factors: 1) if a client *must* not be tiled, it will always use a floating layout and 2) the client's layout is the default layout currently in use by the client's workspace.
Since a layout only maintains a list of potential clients, it is possible to allow layouts to maintain state even when they are not active. That is, when a workspace is in tiling mode, there could be clients in that workspace's floating layout that are currently being tiled. So that if a floating layout needs to access all of its clients, one could do:
for _, client := range floatingLayout.clients { if _, ok := client.Layout().(layout.Floater); ok { // client is currently part of floatingLayout } }
For tiling layouts, this works a little differently since clients can only be in a tiling layout if they aren't forced into a floating layout. Thus, clients in a tiling layout's state can always be assumed to be using that tiler as a layout.
This last point is only possible because layouts are not responsible for knowing whether they are "active" or not. The workspace manages the activity of layouts, and knows when to call "Place" on any particular layout.
(Note that iconified clients are removed from all layouts.)
Index ¶
- Constants
- type Client
- type Heads
- type SelectData
- type Sticky
- func (wrk *Sticky) Add(c Client)
- func (wrk *Sticky) Geom() xrect.Rect
- func (wrk *Sticky) HeadGeom() xrect.Rect
- func (wrk *Sticky) IconifyToggle(c Client)
- func (wrk *Sticky) IsActive() bool
- func (wrk *Sticky) IsVisible() bool
- func (wrk *Sticky) Layout(c Client) layout.Layout
- func (wrk *Sticky) LayoutName() string
- func (wrk *Sticky) Remove(c Client)
- func (wrk *Sticky) String() string
- type Workspace
- func (wrk *Workspace) Activate(greedy bool)
- func (wrk *Workspace) Add(c Client)
- func (wrk *Workspace) AutoCycle()
- func (wrk *Workspace) CheckFloatingStatus(c Client)
- func (wrk *Workspace) Destroy()
- func (wrk *Workspace) Geom() xrect.Rect
- func (wrk *Workspace) HeadGeom() xrect.Rect
- func (wrk *Workspace) Hide()
- func (wrk *Workspace) IconifyToggle(c Client)
- func (wrk *Workspace) IsActive() bool
- func (wrk *Workspace) IsVisible() bool
- func (wrk *Workspace) Layout(c Client) layout.Layout
- func (wrk *Workspace) LayoutAutoTiler() layout.AutoTiler
- func (wrk *Workspace) LayoutFloater() layout.Floater
- func (wrk *Workspace) LayoutName() string
- func (wrk *Workspace) LayoutStateSet(state int)
- func (wrk *Workspace) Place()
- func (wrk *Workspace) Remove(c Client)
- func (wrk *Workspace) RemoveAllAndAdd(newWk *Workspace)
- func (wrk *Workspace) Rename(newName string)
- func (wrk *Workspace) SelectGroupText() string
- func (wrk *Workspace) SelectHighlighted(data interface{})
- func (wrk *Workspace) SelectSelected(data interface{})
- func (wrk *Workspace) SelectText() string
- func (wrk *Workspace) SetLayout(name string)
- func (wrk *Workspace) Show()
- func (wrk *Workspace) String() string
- type Workspacer
- type Workspaces
- func (wrks *Workspaces) Active() *Workspace
- func (wrks *Workspaces) Add(wrk *Workspace)
- func (wrks *Workspaces) Find(name string) *Workspace
- func (wrks *Workspaces) Get(i int) *Workspace
- func (wrks *Workspaces) NewSticky() *Sticky
- func (wrks *Workspaces) NewWorkspace(name string) *Workspace
- func (wrks *Workspaces) Remove(wrk *Workspace)
- func (wrks *Workspaces) Visibles() []*Workspace
Constants ¶
const ( Floating = iota AutoTiling ManualTiling )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Id() xproto.Window String() string Workspace() Workspacer WorkspaceSet(wrk Workspacer) Layout() layout.Layout Map() Unmap() ShouldForceFloating() bool Focus() Raise() Geom() xrect.Rect DragGeom() xrect.Rect Iconified() bool IconifiedSet(iconified bool) IsSticky() bool IsActive() bool HasState(name string) bool SaveState(name string) CopyState(src, dest string) LoadState(name string) DeleteState(name string) MROpt(validate bool, flags, x, y, width, height int) MoveResize(x, y, width, height int) MoveResizeValid(x, y, width, height int) Move(x, y int) Resize(validate bool, width, height int) FrameTile() }
type SelectData ¶
type Workspace ¶
type Workspace struct { X *xgbutil.XUtil Name string State int Clients []Client PromptSlctGroup *prompt.SelectGroupItem PromptSlctItem *prompt.SelectItem // contains filtered or unexported fields }
func (*Workspace) CheckFloatingStatus ¶
CheckFloatingStatus queries the Floating method of a client, and if it's different than what the workspace believes it should be, the proper state transition will be invoked. Namely, if Client.Floating is true, but workspace thinks it's false, the workspace will remove it from its list of tilable clients and re-tile. Otherwise, if Client.Floating is false, but workspace thinks it's true, the workspace will add the client to its list of tilable clients and re-tile.
func (*Workspace) IconifyToggle ¶
func (*Workspace) LayoutAutoTiler ¶
func (*Workspace) LayoutFloater ¶
func (*Workspace) LayoutName ¶
func (*Workspace) LayoutStateSet ¶
func (*Workspace) RemoveAllAndAdd ¶
func (*Workspace) SelectGroupText ¶
func (*Workspace) SelectHighlighted ¶
func (wrk *Workspace) SelectHighlighted(data interface{})
func (*Workspace) SelectSelected ¶
func (wrk *Workspace) SelectSelected(data interface{})
func (*Workspace) SelectText ¶
type Workspacer ¶
type Workspaces ¶
type Workspaces struct { X *xgbutil.XUtil Wrks []*Workspace // contains filtered or unexported fields }
func NewWorkspaces ¶
func NewWorkspaces( X *xgbutil.XUtil, heads Heads, defaultLayout string) *Workspaces
func (*Workspaces) Active ¶
func (wrks *Workspaces) Active() *Workspace
func (*Workspaces) Add ¶
func (wrks *Workspaces) Add(wrk *Workspace)
Add adds a new workspace to the set. Add will panic if a workspace with the same case-insensitive name as wrk already exists. Add will also panic if the workspace has a zero-length name.
func (*Workspaces) Find ¶
func (wrks *Workspaces) Find(name string) *Workspace
func (*Workspaces) Get ¶
func (wrks *Workspaces) Get(i int) *Workspace
func (*Workspaces) NewSticky ¶
func (wrks *Workspaces) NewSticky() *Sticky
func (*Workspaces) NewWorkspace ¶
func (wrks *Workspaces) NewWorkspace(name string) *Workspace
func (*Workspaces) Remove ¶
func (wrks *Workspaces) Remove(wrk *Workspace)
func (*Workspaces) Visibles ¶
func (wrks *Workspaces) Visibles() []*Workspace