From 0b183a89b472462b21b60172e7f29b88413e5811 Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:38:03 +1300 Subject: [PATCH 1/3] Add support for the XDG Base Directory Specification This adds the `XDG_CONFIG_HOME` directory to the `CONFIG_DIRS`, allowing the `~/.tt/*` directory structure to be moved to `~/.config/tt/*`. See also: https://specifications.freedesktop.org/basedir-spec/latest --- src/util.go | 6 ++++++ 1 file changed, 6 insertions(+) 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", } From f68d4efadb56534454f152a5f7c559204cc761a5 Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:42:33 +1300 Subject: [PATCH 2/3] Add documentation of `${XDG_CONFIG_HOME}/tt` paths --- man.md | 4 ++++ 1 file changed, 4 insertions(+) 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\ From 643a5ef5303b605aa3481377c584bc2e98105546 Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:46:33 +1300 Subject: [PATCH 3/3] Add documentation of ${XDG_CONFIG_HOME}/tt paths to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.