config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ManagedAppsLock sync.Mutex
View Source
var Version string

Functions

func AddApplication

func AddApplication(executable string)

AddApplication adds the given executable to the config and tries to write the changes to the config file.

func Initialize

func Initialize()

Initialize loads the configuration from file into the Config struct.

func OpenConfigPath added in v0.1.1

func OpenConfigPath() error

OpenConfigPath tried to issue a command based on the runtime os to reveal the configuration file in a file explorer.

func RemoveApplication

func RemoveApplication(executable string)

RemoveApplication removes the given executable from the config and tries to write the changes to the config file.

func SaveConfig added in v0.4.0

func SaveConfig() error

SaveConfig tries to write the current configuration to file and returns an error if it fails.

Types

type ManagedApp

type ManagedApp struct {
	Executable   string         `toml:"executable"`
	FriendlyName string         `toml:"friendly_name"`
	Dimensions   WindowSettings `toml:"dimensions"`
}

type Type

type Type struct {
	Global struct {
		Width     int  `toml:"width" default:"1920"`
		Height    int  `toml:"height" default:"1090"`
		OffsetX   int  `toml:"offsetX" default:"0"`
		OffsetY   int  `toml:"offsetY" default:"0"`
		Delay     int  `toml:"delay" default:"0"`
		Hotkey    int  `toml:"hotkey" default:"115"`
		DarkTheme bool `toml:"dark_theme" default:"false"`
	} `toml:"global"`
	ManagedApps map[string]ManagedApp `toml:"managed_apps"`
}
var Config Type

type WindowSettings

type WindowSettings struct {
	Width   int `toml:"width"`
	Height  int `toml:"height"`
	OffsetX int `toml:"offsetX"`
	OffsetY int `toml:"offsetY"`
	Delay   int `toml:"delay"`
}

func GetWindowSettings

func GetWindowSettings(executable string) WindowSettings

GetWindowSettings returns the WindowSettings specific to a managed application or the global WindowSettings if no specific or invalid settings were found.

func GetWindowSettingsFromStruct added in v0.4.0

func GetWindowSettingsFromStruct(config Type) WindowSettings

func (WindowSettings) IsValid

func (ws WindowSettings) IsValid() bool

IsValid checks if the window dimensions are valid.

Jump to

Keyboard shortcuts

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