Skip to content

config: follow the XDG base directory spec - #42

Merged
junior merged 2 commits into
p10node:mainfrom
todouu:xdg-config-dir
Nov 14, 2026
Merged

junior merged 2 commits into
p10node:mainfrom
todouu:xdg-config-dir

Conversation

@todouu

@todouu todouu commented Nov 12, 2026

Copy link
Copy Markdown

What

Config, plugins and custom themes now live in $XDG_CONFIG_HOME/k10s (~/.config/k10s when XDG_CONFIG_HOME is unset or not an absolute path, per the XDG spec) instead of ~/.k10s.

Path resolution (internal/config.Path)

  1. $K10S_CONFIG (unchanged)
  2. ~/.k10s/config.yaml, only while ~/.k10s exists and the XDG directory does not. Existing installs keep their settings with no action.
  3. $XDG_CONFIG_HOME/k10s/config.yaml, else ~/.config/k10s/config.yaml

Plugins and themes already resolve relative to config.Path(), so they follow automatically. K10S_PLUGINS, K10S_PLUGIN_DIR and K10S_THEME_DIR still override.

Migration is mv ~/.k10s ~/.config/k10s, documented in docs/config.md. Creating ~/.config/k10s first switches k10s over to it, which is also noted there.

Also changed

  • uninstall.sh resolves the same directory for --purge / the "config still there" hint.
  • Justfile test-install recipe uses the XDG layout.
  • Docs, README, SECURITY.md, example theme and help text updated.
  • New TestPathFollowsXDG in internal/config.

Verification

  • go test ./... passes (Go 1.26.11).
  • uninstall.sh --dry-run --purge checked against: XDG + legacy both present, custom XDG_CONFIG_HOME, legacy only.

Commits are signed off (DCO).

Config, plugins and custom themes now live in $XDG_CONFIG_HOME/k10s
(~/.config/k10s when unset or not absolute) instead of ~/.k10s.

An existing ~/.k10s keeps being used while the XDG directory does not
exist, so upgrading loses no settings. K10S_CONFIG, K10S_PLUGINS,
K10S_PLUGIN_DIR and K10S_THEME_DIR still override as before.

uninstall.sh resolves the same directory; docs, examples and the
test-install recipe are updated.

Signed-off-by: pengshuai <pengshuai4@lenovo.com>
@pierreneter

Copy link
Copy Markdown
Member

@junior what do you think about moving the configuration directory from ~/.k10s to ~/.config/k10s like this (following the XDG Base Directory specification)?

@junior

junior commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Sounds good to me! ~/.config is where people expect config these days, and since ~/.k10s keeps working while it's there, nobody loses their settings on upgrade. I ran the tests with it merged on main and they pass. Happy to have it in the release after v0.1.10.

@pierreneter

Copy link
Copy Markdown
Member

@junior so, we are good to approve and merge!

@junior junior left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Let's merge it right after v0.1.10 goes out.

@junior
junior merged commit 666d19c into p10node:main Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants