diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2022-08-25 08:51:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 05:51:19 +0000 |
commit | 791f79a02a4bbb509c257af2849e411d32f4c18b (patch) | |
tree | 509fe9e6e956dc458234348d4e2eb836a77c1774 /alacritty/src/config/window.rs | |
parent | 8f88b4d4bed337d16e8d3d15d8e20cbe782696db (diff) | |
download | r-alacritty-791f79a02a4bbb509c257af2849e411d32f4c18b.tar.gz r-alacritty-791f79a02a4bbb509c257af2849e411d32f4c18b.tar.bz2 r-alacritty-791f79a02a4bbb509c257af2849e411d32f4c18b.zip |
Rework `--class` CLI option
This commit swaps the order of `general` and `instance` arguments
and also sets `instance` to `general` when only one argument was
provided. This should make this option behave like in other terminals
on X11, since they set either both or general by default, but
not instance like Alacritty.
Fixes #6279.
Diffstat (limited to 'alacritty/src/config/window.rs')
-rw-r--r-- | alacritty/src/config/window.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index 8a59a007..80df87b7 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -203,13 +203,19 @@ pub struct Dimensions { /// Window class hint. #[derive(Serialize, Debug, Clone, PartialEq, Eq)] pub struct Class { - pub instance: String, pub general: String, + pub instance: String, +} + +impl Class { + pub fn new(general: impl ToString, instance: impl ToString) -> Self { + Self { general: general.to_string(), instance: instance.to_string() } + } } impl Default for Class { fn default() -> Self { - Self { instance: DEFAULT_NAME.into(), general: DEFAULT_NAME.into() } + Self::new(DEFAULT_NAME, DEFAULT_NAME) } } |