aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/config')
-rw-r--r--alacritty/src/config/mod.rs6
-rw-r--r--alacritty/src/config/monitor.rs37
-rw-r--r--alacritty/src/config/ui_config.rs6
3 files changed, 22 insertions, 27 deletions
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs
index 43cade6d..4a3c0ae9 100644
--- a/alacritty/src/config/mod.rs
+++ b/alacritty/src/config/mod.rs
@@ -101,8 +101,8 @@ impl From<serde_yaml::Error> for Error {
/// Load the configuration file.
pub fn load(options: &Options) -> Config {
- let config_options = options.config_options().clone();
- let config_path = options.config_path().or_else(installed_config);
+ let config_options = options.config_options.clone();
+ let config_path = options.config_file.clone().or_else(installed_config);
// Load the config using the following fallback behavior:
// - Config path + CLI overrides
@@ -128,7 +128,7 @@ pub fn load(options: &Options) -> Config {
/// Attempt to reload the configuration file.
pub fn reload(config_path: &Path, options: &Options) -> Result<Config> {
// Load config, propagating errors.
- let config_options = options.config_options().clone();
+ let config_options = options.config_options.clone();
let mut config = load_from(config_path, config_options)?;
after_loading(&mut config, options);
diff --git a/alacritty/src/config/monitor.rs b/alacritty/src/config/monitor.rs
index 4a694fac..e3dd0556 100644
--- a/alacritty/src/config/monitor.rs
+++ b/alacritty/src/config/monitor.rs
@@ -1,4 +1,3 @@
-use std::fs;
use std::path::PathBuf;
use std::sync::mpsc;
use std::time::Duration;
@@ -16,23 +15,21 @@ const DEBOUNCE_DELAY: Duration = Duration::from_millis(10);
const DEBOUNCE_DELAY: Duration = Duration::from_millis(1000);
pub fn watch(mut paths: Vec<PathBuf>, event_proxy: EventProxy) {
- // Canonicalize all paths, filtering out the ones that do not exist.
- paths = paths
- .drain(..)
- .filter_map(|path| match fs::canonicalize(&path) {
- Ok(path) => Some(path),
- Err(err) => {
- error!("Unable to canonicalize config path {:?}: {}", path, err);
- None
- },
- })
- .collect();
-
// Don't monitor config if there is no path to watch.
if paths.is_empty() {
return;
}
+ // Canonicalize paths, keeping the base paths for symlinks.
+ for i in 0..paths.len() {
+ if let Ok(canonical_path) = paths[i].canonicalize() {
+ match paths[i].symlink_metadata() {
+ Ok(metadata) if metadata.file_type().is_symlink() => paths.push(canonical_path),
+ _ => paths[i] = canonical_path,
+ }
+ }
+ }
+
// The Duration argument is a debouncing period.
let (tx, rx) = mpsc::channel();
let mut watcher = match watcher(tx, DEBOUNCE_DELAY) {
@@ -73,17 +70,15 @@ pub fn watch(mut paths: Vec<PathBuf>, event_proxy: EventProxy) {
};
match event {
- DebouncedEvent::Rename(..) => continue,
- DebouncedEvent::Write(path)
+ DebouncedEvent::Rename(_, path)
+ | DebouncedEvent::Write(path)
| DebouncedEvent::Create(path)
- | DebouncedEvent::Chmod(path) => {
- if !paths.contains(&path) {
- continue;
- }
-
+ | DebouncedEvent::Chmod(path)
+ if paths.contains(&path) =>
+ {
// Always reload the primary configuration file.
event_proxy.send_event(Event::ConfigReload(paths[0].clone()));
- },
+ }
_ => {},
}
}
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
index f0917cf5..3ce02161 100644
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -70,7 +70,7 @@ pub struct UiConfig {
/// Background opacity from 0.0 to 1.0.
#[config(deprecated = "use window.opacity instead")]
- window_opacity: Option<Percentage>,
+ background_opacity: Option<Percentage>,
}
impl Default for UiConfig {
@@ -85,7 +85,7 @@ impl Default for UiConfig {
config_paths: Default::default(),
key_bindings: Default::default(),
mouse_bindings: Default::default(),
- window_opacity: Default::default(),
+ background_opacity: Default::default(),
bell: Default::default(),
colors: Default::default(),
draw_bold_text_with_bright_colors: Default::default(),
@@ -117,7 +117,7 @@ impl UiConfig {
#[inline]
pub fn window_opacity(&self) -> f32 {
- self.window_opacity.unwrap_or(self.window.opacity).as_f32()
+ self.background_opacity.unwrap_or(self.window.opacity).as_f32()
}
#[inline]