diff options
author | Dustin <dustin1114@gmail.com> | 2019-10-17 15:24:21 -0400 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2019-10-17 21:24:21 +0200 |
commit | a75e9493449d90b54a140b76f6a96b684784a059 (patch) | |
tree | c96f337ee460a7f45fddf2378b1afef977d320ea | |
parent | f1f51d3c0234831131dcaf8e5d63cc906453e51e (diff) | |
download | alacritty-a75e9493449d90b54a140b76f6a96b684784a059.tar.gz alacritty-a75e9493449d90b54a140b76f6a96b684784a059.zip |
Fix window title not filled by default
In the config, if `window` is undefined, the derived `Default` for the
String `title` is used, which is an empty String. This was unintended,
and causes issues in gnome-shell (e.g. in the alt-tab dialog) when the
window title is an empty string.
This commit adds a manually implemented default for the `WindowConfig`,
it's the same as the derived `Default`, except for the `title`, which
will now always be "Alacritty" as originally intended.
-rw-r--r-- | alacritty/src/cli.rs | 3 | ||||
-rw-r--r-- | alacritty_terminal/src/config/window.rs | 20 |
2 files changed, 20 insertions, 3 deletions
diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index b0e3cc94..98edabcb 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -301,8 +301,7 @@ mod test { #[test] fn dynamic_title_ignoring_options_by_default() { - let mut config = Config::default(); - config.window.title = "Alacritty".to_string(); + let config = Config::default(); let old_dynamic_title = config.dynamic_title(); let config = Options::default().into_config(config); diff --git a/alacritty_terminal/src/config/window.rs b/alacritty_terminal/src/config/window.rs index 49bd70bb..3c06f85e 100644 --- a/alacritty_terminal/src/config/window.rs +++ b/alacritty_terminal/src/config/window.rs @@ -9,7 +9,7 @@ use crate::index::{Column, Line}; pub const DEFAULT_NAME: &str = "Alacritty"; #[serde(default)] -#[derive(Deserialize, Debug, Clone, Default, PartialEq, Eq)] +#[derive(Deserialize, Debug, Clone, PartialEq, Eq)] pub struct WindowConfig { /// Initial dimensions #[serde(deserialize_with = "failure_default")] @@ -69,6 +69,24 @@ impl WindowConfig { } } +impl Default for WindowConfig { + fn default() -> WindowConfig { + WindowConfig { + dimensions: Default::default(), + position: Default::default(), + padding: Default::default(), + decorations: Default::default(), + dynamic_padding: Default::default(), + startup_mode: Default::default(), + class: Default::default(), + embed: Default::default(), + gtk_theme_variant: Default::default(), + start_maximized: Default::default(), + title: default_title(), + } + } +} + #[derive(Debug, Deserialize, Copy, Clone, PartialEq, Eq)] pub enum StartupMode { Windowed, |