workspace

package
v0.0.0-...-d8427d5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DistributionInterval = 15 * time.Second

DistributionInterval is the amount of time between each automatic redistribution. These will happen periodically, regardless of any messages being sent down the message channel.

View Source
const OverlayDuration = 500 * time.Millisecond

OverlayDuration specifies how long the overlay will stay on the screen for.

View Source
const SwitchTimeout = time.Second

SwitchTimeout is the amount of time the switcher will wait for outbound message acknowledgement.

Variables

This section is empty.

Functions

This section is empty.

Types

type DistributorThread

type DistributorThread struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DistributorThread is a long-running process that handles re-distributing workspaces so that i3x3 remains functional. Whenever an X event occurs, or also periodically, workspaces will be placed on the output that i3x3 expects them to be on.

func NewDistributorThread

func NewDistributorThread(logger log15.Logger, msgCh chan struct{}) *DistributorThread

NewDistributorThread creates a new workspace distributor thread.

func (*DistributorThread) Start

func (t *DistributorThread) Start() error

Start attempts to start the distributor thread.

func (*DistributorThread) Stop

func (t *DistributorThread) Stop() error

Stop attempts to stop the distributor thread.

type OverlayThread

type OverlayThread struct {
	sync.Mutex
	// contains filtered or unexported fields
}

OverlayThread is a long-running process than handles showing the GTK-based overlay.

func NewOverlayThread

func NewOverlayThread(logger log15.Logger, msgCh <-chan SwitchMessage) *OverlayThread

NewOverlayThread creates a new workspace overlay thread.

func (*OverlayThread) Start

func (t *OverlayThread) Start() error

Start attempts to start the overlay thread.

func (*OverlayThread) Stop

func (t *OverlayThread) Stop() error

Stop attempts to stop the overlay thread.

type SwitchMessage

type SwitchMessage struct {
	// Context is a context used to cancel downstream events. It should be set with a timeout.
	Context context.Context
	// ResponseCh is a channel to send a response down. The response may simply be nil, indicating
	// success. If an error is sent, it may bubble up and be sent to the client.
	ResponseCh chan<- error
	// Environment is a grid environment (containing things about the current state of the grid).
	Environment grid.Environment
	// Target is the workspace we're going to switch to, if we're going to switch workspaces.
	Target float64
}

SwitchResult is the result of an attempt to switch workspaces.

func NewSwitchMessage

func NewSwitchMessage(ctx context.Context, env grid.Environment, target float64) (SwitchMessage, chan error)

NewSwitchMessage creates a new switch message, used to notify some consumer.

type SwitchThread

type SwitchThread struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SwitchThread is the long-running workspace switcher. It will process one message at a time.

func NewSwitchThread

func NewSwitchThread(logger log15.Logger, msgCh <-chan rpc.Message, outCh chan<- SwitchMessage) *SwitchThread

NewSwitchThread creates a new workspace switcher thread.

func (*SwitchThread) Start

func (t *SwitchThread) Start() error

Start a loop that will loop until canceled. It waits for messages to come in, handles them, and sends a response back to the message sender.

func (*SwitchThread) Stop

func (t *SwitchThread) Stop() error

Stop attempts to gracefully stop the switcher's loop.

Jump to

Keyboard shortcuts

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