Added theme customization via config.toml #17 ``` [theme] border = "#665C54" accent = "#FABD2F" muted = "#928374" text = "#EBDBB2" text_sel = "#FBF1C7" match = "#FE8019" desc = "#A89984" desc_sel = "#EBDBB2" sel_bg = "#504945" scroll_info = "#83A598" ghost_text = "#7C6F64" hist= "#fe8019" hist_sel = "#d65d0e" sys = "#fb4934" sys_sel = "#cc241d" alias = "#b8bb26" alias_sel = "#98971a" ``` --------- Co-authored-by: verse91 <versedev.store@proton.me> Co-authored-by: VERSE <sunnyone0901@gmail.com>
71 lines
1.5 KiB
Go
71 lines
1.5 KiB
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func ConfigPath() (string, error) {
|
|
configHome := os.Getenv("XDG_CONFIG_HOME")
|
|
if configHome != "" {
|
|
return filepath.Join(configHome, "iris", "config.toml"), nil
|
|
}
|
|
dir, err := os.UserConfigDir()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(dir, "iris", "config.toml"), nil
|
|
}
|
|
|
|
func ThemePath() (string, error) {
|
|
configHome := os.Getenv("XDG_CONFIG_HOME")
|
|
if configHome != "" {
|
|
return filepath.Join(configHome, "iris", "theme.toml"), nil
|
|
}
|
|
dir, err := os.UserConfigDir()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(dir, "iris", "theme.toml"), nil
|
|
}
|
|
|
|
func StatePath() (string, error) {
|
|
dataHome := os.Getenv("XDG_DATA_HOME")
|
|
if dataHome == "" {
|
|
home, err := os.UserHomeDir()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
dataHome = filepath.Join(home, ".local", "share")
|
|
}
|
|
return filepath.Join(dataHome, "iris", "state.toml"), nil
|
|
}
|
|
|
|
func HistoryDBPath() (string, error) {
|
|
statePath, err := StatePath()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(filepath.Dir(statePath), "history.db"), nil
|
|
}
|
|
|
|
func CachePath() (string, error) {
|
|
cacheHome := os.Getenv("XDG_CACHE_HOME")
|
|
if cacheHome != "" {
|
|
return filepath.Join(cacheHome, "iris"), nil
|
|
}
|
|
dir, err := os.UserCacheDir()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(dir, "iris"), nil
|
|
}
|
|
|
|
func CrashDir() (string, error) {
|
|
cache, err := CachePath()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(cache, "crashes"), nil
|
|
}
|