aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Corona <ac@albertocorona.com>2017-01-07 18:12:28 -0600
committerJoe Wilm <jwilm@users.noreply.github.com>2017-01-09 09:23:32 -0800
commit929403386cd855a1715334db9c6c4cd1ae08f4a6 (patch)
treea7284aab156b4743ee1ec6a84a6594b817e44f14
parent987b8555def9b321d8388d7ca8290d214bc51c4a (diff)
downloadalacritty-929403386cd855a1715334db9c6c4cd1ae08f4a6.tar.gz
alacritty-929403386cd855a1715334db9c6c4cd1ae08f4a6.zip
Support config path `$XDG_CONFIG/alacritty.yml`
- Update README to reflect changes
-rw-r--r--README.md7
-rw-r--r--src/config.rs8
2 files changed, 11 insertions, 4 deletions
diff --git a/README.md b/README.md
index df04bdc4..7336533f 100644
--- a/README.md
+++ b/README.md
@@ -143,10 +143,11 @@ you'll probably end up wanting to customize it anyhow. There is a default
file as the following paths:
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`
-once alacritty is first run.
+If neither path 1 or 2 are found then `$HOME/.config/alacritty/alacritty.yml`
+is created as or once alacritty is first run.
Many configuration options will take effect immediately upon saving changes to
the config file. The only exception is the `font` and `dpi` section which
diff --git a/src/config.rs b/src/config.rs
index 706f1d01..b3ca5bdb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -812,7 +812,8 @@ impl Config {
/// The config file is loaded from the first file it finds in this list of paths
///
/// 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> {
let home = env::var("HOME")?;
@@ -820,6 +821,11 @@ impl Config {
let path = ::xdg::BaseDirectories::with_prefix("alacritty")
.ok()
.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(|| {
// Fallback path: $HOME/.config/alacritty/alacritty.yml
let mut alt_path = PathBuf::from(&home);