cfg

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cfg allows for reading the user's configuration.

Index

Constants

View Source
const (
	ActionIngameFocus int = iota
	ActionIngameReset
	ActionIngameRes
	ActionWallFocus
	ActionWallResetAll
	ActionWallLock
	ActionWallPlay
	ActionWallReset
	ActionWallResetOthers
	ActionWallPlayFirstLocked
)

Keybind actions

Variables

This section is empty.

Functions

func GetCpuCount

func GetCpuCount() int

GetCpuCount returns the number of CPUs on the user's system.

func GetDirectory

func GetDirectory() (string, error)

GetDirectory returns the path to the user's configuration directory.

func MakeProfile

func MakeProfile(name string) error

MakeProfile makes a new configuration profile with the given name and the default settings.

Types

type Action

type Action struct {
	// The type of action.
	Type int

	// Extra detail for the action (e.g. instance number.)
	Extra *int
}

Action represents a single keybind action.

type ActionList

type ActionList struct {
	IngameActions []Action
	WallActions   []Action
}

ActionList contains a list of actions to perform when a keybind is pressed.

func (*ActionList) UnmarshalTOML

func (a *ActionList) UnmarshalTOML(value any) error

UnmarshalTOML implements toml.Unmarshaler.

type Bind

type Bind struct {
	Button   *xproto.Button    // The button for this keybind (if any.)
	Key      *xproto.Keycode   // The key for this keybind (if any.)
	Mods     [4]xproto.Keycode // The list of key modifiers for this keybind (if any.)
	ModCount int               // The number of modifiers in use.
	// contains filtered or unexported fields
}

Bind represents a single keybinding.

func (*Bind) String

func (b *Bind) String() string

String implements Stringer.

func (*Bind) UnmarshalTOML

func (b *Bind) UnmarshalTOML(value any) error

UnmarshalTOML implements toml.Unmarshaler.

type Delays

type Delays struct {
	WpPause   int `toml:"wp_pause"`      // WorldPreview F3+Esc
	IdlePause int `toml:"idle_pause"`    // Idle F3+Esc
	Unpause   int `toml:"unpause"`       // Unpause on focus
	Stretch   int `toml:"stretch"`       // Resize
	GhostPie  int `toml:"ghost_pie_fix"` // Ghost pie fix
	Warp      int `toml:"warp_pointer"`  // Warp pointer fix
}

Delays contains various delays to make certain actions more consistent.

type Group

type Group struct {
	// The space this group occupies on the wall scene.
	Space Rectangle `toml:"position"`

	// Whether instances in this group can be clicked on.
	Cosmetic bool `toml:"cosmetic"`

	Width  uint32 `toml:"width"`  // Width of the group, in instances.
	Height uint32 `toml:"height"` // Height of the group, in instances.
}

Group represents a group of instances for moving.

type Hooks

type Hooks struct {
	Reset      string `toml:"reset"`       // Command to run on ingame reset
	AltRes     string `toml:"alt_res"`     // Command to run on alternate resolution
	NormalRes  string `toml:"normal_res"`  // Command to run on normal resolution
	WallLock   string `toml:"wall_lock"`   // Command to run on wall reset
	WallUnlock string `toml:"wall_unlock"` // Command to run on wall unlock
	WallPlay   string `toml:"wall_play"`   // Command to run on wall play
	WallReset  string `toml:"wall_reset"`  // Command to run on wall reset
}

Hooks contains various commands to run whenever the user performs certain actions.

type Keybinds

type Keybinds map[Bind]ActionList

Keybinds contains the user's keybindings.

func (*Keybinds) UnmarshalTOML

func (k *Keybinds) UnmarshalTOML(value any) error

UnmarshalTOML implements toml.Unmarshaler.

type Obs

type Obs struct {
	Enabled   bool    `toml:"enabled"`    // Mandatory for wall
	Port      uint16  `toml:"port"`       // Connection port
	Password  string  `toml:"password"`   // Password, can be left blank if unused
	Port2     *uint16 `toml:"port_2"`     // Verification connection port
	Password2 *string `toml:"password_2"` // Verification connection password
}

Obs contains the user's OBS websocket connection information.

type Profile

type Profile struct {
	ResetCount   string     `toml:"reset_count"`   // Reset counter path
	UnpauseFocus bool       `toml:"unpause_focus"` // Whether to unpause on focus
	PollRate     int        `toml:"poll_rate"`     // Polling rate for input handling
	NormalRes    *Rectangle `toml:"play_res"`      // Normal resolution
	AltRes       *Rectangle `toml:"alt_res"`       // Alternate ingame resolution

	Delay    Delays   `toml:"delay"`
	Hooks    Hooks    `toml:"hooks"`
	Keybinds Keybinds `toml:"keybinds"`
	Obs      Obs      `toml:"obs"`
	Wall     Wall     `toml:"wall"`
}

Profile contains an entire configuration profile.

func GetProfile

func GetProfile(name string) (Profile, error)

GetProfile returns a parsed configuration profile.

type Rectangle

type Rectangle struct {
	X, Y int32
	W, H uint32
}

Rectangle is a rectangle. That's it.

func (*Rectangle) UnmarshalTOML

func (r *Rectangle) UnmarshalTOML(value any) error

UnmarshalTOML implements toml.Unmarshaler.

type Wall

type Wall struct {
	Enabled        bool `toml:"enabled"`         // Whether to use multi or wall
	ConfinePointer bool `toml:"confine_pointer"` // Whether or not to confine the pointer to the projector
	GotoLocked     bool `toml:"goto_locked"`     // Also known as wall bypass
	ResetUnlock    bool `toml:"reset_unlock"`    // Reset on unlock
	GracePeriod    int  `toml:"grace_period"`    // Milliseconds to wait after preview before a reset can occur

	StretchRes *Rectangle `toml:"stretch_res"` // Inactive resolution
	UseF1      bool       `toml:"use_f1"`

	// Preview percentage to freeze instances at.
	FreezeAt int `toml:"freeze_at"`

	// Preview percentage to show instances at.
	ShowAt int `toml:"show_at"`

	WallWindow string `toml:"wall_window"` // Name of the wall window

	// Instance moving settings.
	Moving struct {
		Enabled         bool    `toml:"enabled"`
		ResetBeforePlay bool    `toml:"force_reset_before_play"` // Force user to keep all but first group empty
		Gaps            bool    `toml:"use_gaps"`                // Whether to leave gaps when instances are locked
		Locks           *Group  `toml:"locks"`                   // Locked group
		Groups          []Group `toml:"groups"`                  // Normal groups
	} `toml:"moving"`

	// Performance settings.
	Perf struct {
		// Optional. Overrides the default sleepbg.lock path ($HOME)
		SleepbgPath string `toml:"sleepbg_path"`

		// Whether or not to use affinity.
		Affinity string `toml:"affinity"`

		// Sequential affinity settings.
		Seq struct {
			// The number of CPUs to give to the active instance.
			ActiveCpus int `toml:"active_cpus"`

			// The number of CPUs to give to background instances.
			BackgroundCpus int `toml:"background_cpus"`

			// The number of CPUs to give to locked instances.
			LockCpus int `toml:"lock_cpus"`
		} `toml:"sequence"`

		// Advanced affinity settings.
		Adv struct {
			CcxSplit int `toml:"ccx_split"`

			CpusIdle   int `toml:"affinity_idle"`   // CPUs for idle group
			CpusLow    int `toml:"affinity_low"`    // CPUs for low group
			CpusMid    int `toml:"affinity_mid"`    // CPUs for mid group
			CpusHigh   int `toml:"affinity_high"`   // CPUs for high group
			CpusActive int `toml:"affinity_active"` // CPUs for active group

			// The number of milliseconds to wait after an instance finishes
			// generating to move it from the mid group to the idle group.
			// A value of 0 disables this functionality.
			BurstLength int `toml:"burst_length"`

			// The world generation percentage at which instances are moved from
			// the high group to the low group.
			LowThreshold int `toml:"low_threshold"`
		} `toml:"advanced"`
	} `toml:"performance"`
}

Wall contains the user's wall settings.

Jump to

Keyboard shortcuts

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