cfg

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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 (
	ActionIngameReset int = iota
	ActionIngameFocus
	ActionIngameRes
)

Keybind actions

Variables

This section is empty.

Functions

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 AltRes added in v0.6.0

type AltRes []Rectangle

AltRes represents a list of alternate resolutions.

func (*AltRes) UnmarshalTOML added in v0.6.0

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

UnmarshalTOML implements toml.Unmarshaler.

type AltResHook added in v0.6.0

type AltResHook []string

AltResHook represents a list of hooks to run for each alternate resolution (in order).

func (*AltResHook) UnmarshalTOML added in v0.6.0

func (a *AltResHook) 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 Hooks

type Hooks struct {
	Reset       string        `toml:"reset"`        // Command to run on ingame reset
	AltRes      AltResHook    `toml:"alt_res"`      // Command to run on alternate resolution
	NormalRes   NormalResHook `toml:"normal_res"`   // Command to run on normal resolution
	FocusLost   string        `toml:"focus_lost"`   // Command to run when instance loses focus
	FocusGained string        `toml:"focus_gained"` // Command to run when instance gains focus
}

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 NormalResHook added in v0.6.0

type NormalResHook []string

AltResHook represents a list of hooks to run for each alternate resolution (in order) when switching from that resolution to the normal resolution.

func (*NormalResHook) UnmarshalTOML added in v0.6.0

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

UnmarshalTOML implements toml.Unmarshaler.

type Profile

type Profile struct {
	PollRate  int        `toml:"poll_rate"` // Polling rate for input handling
	NormalRes *Rectangle `toml:"play_res"`  // Normal resolution
	AltRes    AltRes     `toml:"alt_res"`   // Alternate ingame resolution

	Hooks    Hooks    `toml:"hooks"`
	Keybinds Keybinds `toml:"keybinds"`
}

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.

Jump to

Keyboard shortcuts

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