prefs

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "chapar"

Variables

This section is empty.

Functions

func AddGlobalConfigChangeListener

func AddGlobalConfigChangeListener(listener GlobalConfigChangeListener)

func GetAppState

func GetAppState() domain.AppState

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the appropriate directory for storing configuration files based on the current operating system.

func GetGlobalConfig

func GetGlobalConfig() domain.GlobalConfig

func GetWorkspacePath

func GetWorkspacePath() string

func SetUseUseHorizontalSplit added in v0.4.2

func SetUseUseHorizontalSplit(use bool) error

func UpdateAppState

func UpdateAppState(config domain.AppState) error

func UpdateGlobalConfig

func UpdateGlobalConfig(config domain.GlobalConfig) error

Types

type AppStateChangeListener

type AppStateChangeListener func(old, updated domain.AppState)

type GlobalConfigChangeListener

type GlobalConfigChangeListener func(old, updated domain.GlobalConfig)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles loading, saving, and migrating preferences and config

func GetInstance

func GetInstance() *Manager

GetInstance returns the singleton instance of the Manager

func (*Manager) AddAppStateChangeListener

func (m *Manager) AddAppStateChangeListener(listener AppStateChangeListener)

func (*Manager) AddGlobalConfigChangeListener

func (m *Manager) AddGlobalConfigChangeListener(listener GlobalConfigChangeListener)

func (*Manager) GetAppState

func (m *Manager) GetAppState() domain.AppState

GetAppState returns a copy of the app state

func (*Manager) GetGlobalConfig

func (m *Manager) GetGlobalConfig() domain.GlobalConfig

GetGlobalConfig returns a copy of the global config

func (*Manager) Load

func (m *Manager) Load() error

Load loads both globalConfig and appState from disk, performing migration from old format if needed

func (*Manager) Save

func (m *Manager) Save() error

Save persists both globalConfig and appState to disk

func (*Manager) UpdateAppState

func (m *Manager) UpdateAppState(state domain.AppState) error

UpdateAppState updates the app state

func (*Manager) UpdateGlobalConfig

func (m *Manager) UpdateGlobalConfig(config domain.GlobalConfig) error

UpdateGlobalConfig updates the global config

Jump to

Keyboard shortcuts

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