Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions man.md
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down
6 changes: 6 additions & 0 deletions src/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down