Problem
On macOS, abtop does not respect XDG_CONFIG_HOME when resolving its configuration file.
The documentation says the configuration is stored at:
~/.config/abtop/config.toml
However, abtop currently resolves the path with:
dirs::config_dir().map(|dir| dir.join("abtop").join("config.toml"))
On macOS, dirs::config_dir() returns:
~/Library/Application Support
Consequently, abtop reads and writes:
~/Library/Application Support/abtop/config.toml
This happens even when the user has explicitly configured:
export XDG_CONFIG_HOME="$HOME/.config"
As a result, $XDG_CONFIG_HOME/abtop/config.toml is silently ignored. This is confusing because the documented configuration file exists, but settings such as theme = "btop" have no effect.
Requested behavior
When XDG_CONFIG_HOME is set and non-empty, abtop should read and write:
$XDG_CONFIG_HOME/abtop/config.toml
For example:
export XDG_CONFIG_HOME="$HOME/.config"
should make abtop use:
~/.config/abtop/config.toml
When XDG_CONFIG_HOME is unset or empty, abtop can retain its current platform-specific fallback:
~/Library/Application Support/abtop/config.toml
Suggested resolution order
$XDG_CONFIG_HOME/abtop/config.toml when XDG_CONFIG_HOME is set and non-empty.
dirs::config_dir()/abtop/config.toml as the platform-specific fallback.
For example:
fn config_path() -> Option<PathBuf> {
std::env::var_os("XDG_CONFIG_HOME")
.filter(|value| !value.is_empty())
.map(PathBuf::from)
.or_else(dirs::config_dir)
.map(|dir| dir.join("abtop").join("config.toml"))
}
The same resolved path should be used for both loading and saving configuration.
Steps to reproduce
-
On macOS, set:
export XDG_CONFIG_HOME="$HOME/.config"
-
Create ~/.config/abtop/config.toml with:
-
Create or retain ~/Library/Application Support/abtop/config.toml with:
-
Start abtop.
Actual behavior
abtop uses the configuration under ~/Library/Application Support/abtop/ and displays the Catppuccin theme.
The file under $XDG_CONFIG_HOME/abtop/ is ignored.
Expected behavior
Because XDG_CONFIG_HOME is explicitly set, abtop should use $XDG_CONFIG_HOME/abtop/config.toml and display the btop theme.
Environment
- abtop: 0.5.5
- Operating system: macOS
- Installation method: release shell installer
- Relevant dependency:
dirs 6.0.0
Documentation
The configuration documentation should also describe the lookup order and mention the macOS fallback path.
Problem
On macOS,
abtopdoes not respectXDG_CONFIG_HOMEwhen resolving its configuration file.The documentation says the configuration is stored at:
However,
abtopcurrently resolves the path with:On macOS,
dirs::config_dir()returns:Consequently,
abtopreads and writes:This happens even when the user has explicitly configured:
As a result,
$XDG_CONFIG_HOME/abtop/config.tomlis silently ignored. This is confusing because the documented configuration file exists, but settings such astheme = "btop"have no effect.Requested behavior
When
XDG_CONFIG_HOMEis set and non-empty,abtopshould read and write:For example:
should make
abtopuse:When
XDG_CONFIG_HOMEis unset or empty,abtopcan retain its current platform-specific fallback:Suggested resolution order
$XDG_CONFIG_HOME/abtop/config.tomlwhenXDG_CONFIG_HOMEis set and non-empty.dirs::config_dir()/abtop/config.tomlas the platform-specific fallback.For example:
The same resolved path should be used for both loading and saving configuration.
Steps to reproduce
On macOS, set:
Create
~/.config/abtop/config.tomlwith:Create or retain
~/Library/Application Support/abtop/config.tomlwith:Start
abtop.Actual behavior
abtopuses the configuration under~/Library/Application Support/abtop/and displays the Catppuccin theme.The file under
$XDG_CONFIG_HOME/abtop/is ignored.Expected behavior
Because
XDG_CONFIG_HOMEis explicitly set,abtopshould use$XDG_CONFIG_HOME/abtop/config.tomland display thebtoptheme.Environment
dirs6.0.0Documentation
The configuration documentation should also describe the lookup order and mention the macOS fallback path.