diff --git a/README.md b/README.md index 439ca6a..bf6dc5e 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,8 @@ See `-help` for an exhaustive list of options. ## Configuration -Custom themes and word lists can be defined in `~/.tt/themes` and `~/.tt/words` +Custom themes and word lists can be defined in `~/.config/tt/themes` and `~/.config/tt/words` +(or `~/.tt/themes` and `~/.tt/words`, if no `tt` directory exists in `XDG_CONFIG_HOME`) and used in conjunction with the `-theme` and `-words` flags. A list of preloaded themes and word lists can be found in `words/` and `themes/` and are accessible by default using the respective flags. diff --git a/man.md b/man.md index aa593ad..6818b10 100644 --- a/man.md +++ b/man.md @@ -195,6 +195,10 @@ Modify to taste. not exist, the following directories are searched for a file with the given name before falling back to internal resources: + ${XDG_CONFIG_HOME}/tt/words\ + ${XDG_CONFIG_HOME}/tt/themes\ + ~/.config/tt/words\ + ~/.config/tt/themes\ ~/.tt/words\ ~/.tt/themes\ /etc/tt/words\ diff --git a/src/util.go b/src/util.go index 66f005b..90dd869 100644 --- a/src/util.go +++ b/src/util.go @@ -18,7 +18,13 @@ var CONFIG_DIRS []string func init() { home, _ := os.LookupEnv("HOME") + configDir, isConfigSet := os.LookupEnv("XDG_CONFIG_HOME") + if !isConfigSet { + configDir = filepath.Join(home, ".config") + } + CONFIG_DIRS = []string{ + filepath.Join(configDir, "tt"), filepath.Join(home, ".tt"), "/etc/tt", }