mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Support config path $XDG_CONFIG/alacritty.yml
- Update README to reflect changes
This commit is contained in:
parent
987b8555de
commit
929403386c
2 changed files with 11 additions and 4 deletions
|
@ -143,10 +143,11 @@ you'll probably end up wanting to customize it anyhow. There is a default
|
||||||
file as the following paths:
|
file as the following paths:
|
||||||
|
|
||||||
1. `$XDG_CONFIG_HOME/alacritty/alacritty.yml`
|
1. `$XDG_CONFIG_HOME/alacritty/alacritty.yml`
|
||||||
2. `$HOME/.config/alacritty/alacritty.yml`
|
2. `$XDG_CONFIG_HOME/alacritty.yml`
|
||||||
|
3. `$HOME/.config/alacritty/alacritty.yml`
|
||||||
|
|
||||||
If these files are not found then one is created as `$HOME/.config/alacritty/alacritty.yml`
|
If neither path 1 or 2 are found then `$HOME/.config/alacritty/alacritty.yml`
|
||||||
once alacritty is first run.
|
is created as or once alacritty is first run.
|
||||||
|
|
||||||
Many configuration options will take effect immediately upon saving changes to
|
Many configuration options will take effect immediately upon saving changes to
|
||||||
the config file. The only exception is the `font` and `dpi` section which
|
the config file. The only exception is the `font` and `dpi` section which
|
||||||
|
|
|
@ -812,7 +812,8 @@ impl Config {
|
||||||
/// The config file is loaded from the first file it finds in this list of paths
|
/// The config file is loaded from the first file it finds in this list of paths
|
||||||
///
|
///
|
||||||
/// 1. $XDG_CONFIG_HOME/alacritty/alacritty.yml
|
/// 1. $XDG_CONFIG_HOME/alacritty/alacritty.yml
|
||||||
/// 2. $HOME/.config/alacritty/alacritty.yml
|
/// 2. $XDG_CONFIG_HOME/alacritty.yml
|
||||||
|
/// 3. $HOME/.config/alacritty/alacritty.yml
|
||||||
pub fn load() -> Result<Config> {
|
pub fn load() -> Result<Config> {
|
||||||
let home = env::var("HOME")?;
|
let home = env::var("HOME")?;
|
||||||
|
|
||||||
|
@ -820,6 +821,11 @@ impl Config {
|
||||||
let path = ::xdg::BaseDirectories::with_prefix("alacritty")
|
let path = ::xdg::BaseDirectories::with_prefix("alacritty")
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|xdg| xdg.find_config_file("alacritty.yml"))
|
.and_then(|xdg| xdg.find_config_file("alacritty.yml"))
|
||||||
|
.or_else(|| {
|
||||||
|
::xdg::BaseDirectories::new().ok().and_then(|fallback| {
|
||||||
|
fallback.find_config_file("alacritty.yml")
|
||||||
|
})
|
||||||
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
// Fallback path: $HOME/.config/alacritty/alacritty.yml
|
// Fallback path: $HOME/.config/alacritty/alacritty.yml
|
||||||
let mut alt_path = PathBuf::from(&home);
|
let mut alt_path = PathBuf::from(&home);
|
||||||
|
|
Loading…
Reference in a new issue