Documentation ¶
Overview ¶
Package ctl implements the main controller used for all of the available resetting schemes (e.g. multi, wall.)
Index ¶
- Constants
- func Run(conf *cfg.Profile) error
- type Controller
- func (c *Controller) CreateSleepbgLock()
- func (c *Controller) DeleteSleepbgLock(ignoreErrors bool)
- func (c *Controller) FocusInstance(id int)
- func (c *Controller) PlayInstance(id int)
- func (c *Controller) ResetInstance(id int) bool
- func (c *Controller) RunHook(hook int)
- func (c *Controller) SetPriority(id int, prio bool)
- func (c *Controller) ToggleResolution(id int)
- type CpuManager
- type Frontend
- type Input
- type MovingWall
- type Multi
- type ProjectorController
- func (p *ProjectorController) Focus() error
- func (p *ProjectorController) InBounds(x, y int) bool
- func (p *ProjectorController) ProcessEvent(evt x11.Event)
- func (p *ProjectorController) Setup(conf *cfg.Profile, obs *obs.Client, x *x11.Client) error
- func (p *ProjectorController) ToScreen(x, y int) (int, int)
- func (p *ProjectorController) ToVideo(x, y int) (int, int)
- func (p *ProjectorController) Unfocus()
- type Wall
Constants ¶
const ( HookReset int = iota HookAltRes HookNormalRes HookLock HookUnlock HookWallPlay HookWallReset )
Hook types
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages all of the components necessary for resetti to run and handles communication between them.
func (*Controller) CreateSleepbgLock ¶
func (c *Controller) CreateSleepbgLock()
CreateSleepbgLock creates the sleepbg.lock file.
func (*Controller) DeleteSleepbgLock ¶
func (c *Controller) DeleteSleepbgLock(ignoreErrors bool)
DeleteSleepbgLock deletes the sleepbg.lock file.
func (*Controller) FocusInstance ¶
func (c *Controller) FocusInstance(id int)
FocusInstance switches focus to the given instance.
func (*Controller) PlayInstance ¶
func (c *Controller) PlayInstance(id int)
PlayInstance switches focus to the given instance, marks it as the active instance, and starts playing it.
func (*Controller) ResetInstance ¶
func (c *Controller) ResetInstance(id int) bool
ResetInstance attempts to reset the given instance and returns whether or not the reset was successful.
func (*Controller) RunHook ¶
func (c *Controller) RunHook(hook int)
RunHook runs the hook of the given type if it exists.
func (*Controller) SetPriority ¶
func (c *Controller) SetPriority(id int, prio bool)
SetPriority sets the priority of the instance in the CPU manager.
func (*Controller) ToggleResolution ¶
func (c *Controller) ToggleResolution(id int)
ToggleResolution switches the given instance between the normal and alternate resolution.
type CpuManager ¶
type CpuManager interface { // Run handles state updates and moves instances between affinity groups. Run(context.Context, *sync.WaitGroup) // SetPriority sets the priority state of the given instance. SetPriority(int, bool) // Update updates the affinity state of the given instance as needed based on // the state change. Update(mc.Update) }
CpuManager controls how much CPU time is given to each instance bsaed on its state.
func NewCpuManager ¶
func NewCpuManager(instances []mc.InstanceInfo, states []mc.State, conf *cfg.Profile) (CpuManager, error)
NewCpuManager creates a new cpuManager for the given instances and config profile. If necessary, it prompts the user for root permission and runs the cgroup creation script.
type Frontend ¶
type Frontend interface { // Input processes a single user input. Input(Input) // ProcessEvent processes a miscellanous event from the X server. ProcessEvent(x11.Event) // Setup takes in all of the potentially needed dependencies and prepares // the Frontend to handle user input. Setup(frontendDependencies) error // Update processes a single instance state update. Update(mc.Update) }
A Frontend handles user-facing I/O (input handling, instance actions, OBS output) and communicates with a Controller.
type MovingWall ¶
type MovingWall struct {
// contains filtered or unexported fields
}
MovingWall implements a "moving wall" interface, where the user can see one or more groups of instances on an OBS projector and manage them from there.
func (*MovingWall) Input ¶
func (m *MovingWall) Input(input Input)
Input processes a single user input.
func (*MovingWall) ProcessEvent ¶
func (m *MovingWall) ProcessEvent(evt x11.Event)
ProcessEvent implements Frontend.
func (*MovingWall) Setup ¶
func (m *MovingWall) Setup(deps frontendDependencies) error
Setup implements Frontend.
func (*MovingWall) Update ¶
func (m *MovingWall) Update(update mc.Update)
Update processes a single instance state update.
type Multi ¶
type Multi struct {
// contains filtered or unexported fields
}
Multi implements a traditional Multi-instance interface, where the user plays and resets one instance at a time.
func (*Multi) ProcessEvent ¶
ProcessEvent implements Frontend.
type ProjectorController ¶
type ProjectorController struct { Active bool // Whether the projector is focused BaseWidth, BaseHeight int // OBS canvas size // contains filtered or unexported fields }
ProjectorController maintains information about the state of the OBS projector and the mouse pointer.
func (*ProjectorController) Focus ¶
func (p *ProjectorController) Focus() error
Focus finds the wall projector and focuses it.
func (*ProjectorController) InBounds ¶
func (p *ProjectorController) InBounds(x, y int) bool
InBounds returns whether or not the given coordinates are outside the bounds of the projector window.
func (*ProjectorController) ProcessEvent ¶
func (p *ProjectorController) ProcessEvent(evt x11.Event)
ProcessEvent processes a single event.
func (*ProjectorController) ToScreen ¶
func (p *ProjectorController) ToScreen(x, y int) (int, int)
ToScreen translates the given OBS video coordinates to screen coordinates.
func (*ProjectorController) ToVideo ¶
func (p *ProjectorController) ToVideo(x, y int) (int, int)
ToVideo translates the given screen coordinates to OBS video coordinates.
func (*ProjectorController) Unfocus ¶
func (p *ProjectorController) Unfocus()
Unfocus signals that the user left the projector.
type Wall ¶
type Wall struct {
// contains filtered or unexported fields
}
Wall implements a standard "Wall" interface, where the user can see all of their instances on an OBS projector and manage them from there.
func (*Wall) ProcessEvent ¶
ProcessEvent implements Frontend.