summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/config/window.rs
diff options
context:
space:
mode:
authorBrian Koropoff <bkoropoff@gmail.com>2019-07-06 12:34:56 -0700
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-07-06 19:34:56 +0000
commit228c641769c39bcd1460959e479b2259e7d5f773 (patch)
treef7bece352f9063753aa5af834bcb31eeecb82914 /alacritty_terminal/src/config/window.rs
parente398eb84064c5eac7cb8a97c276494100a37314b (diff)
downloadalacritty-228c641769c39bcd1460959e479b2259e7d5f773.tar.gz
alacritty-228c641769c39bcd1460959e479b2259e7d5f773.zip
Allow setting gtk variant and general class on X11
Diffstat (limited to 'alacritty_terminal/src/config/window.rs')
-rw-r--r--alacritty_terminal/src/config/window.rs31
1 files changed, 28 insertions, 3 deletions
diff --git a/alacritty_terminal/src/config/window.rs b/alacritty_terminal/src/config/window.rs
index d7f3dcbf..351bef10 100644
--- a/alacritty_terminal/src/config/window.rs
+++ b/alacritty_terminal/src/config/window.rs
@@ -1,5 +1,6 @@
-use crate::config::{failure_default, Delta};
+use crate::config::{failure_default, option_explicit_none, from_string_or_deserialize, Delta, FromString};
use crate::index::{Column, Line};
+use crate::window::DEFAULT_NAME;
#[serde(default)]
#[derive(Deserialize, Debug, Clone, Default, PartialEq, Eq)]
@@ -33,8 +34,12 @@ pub struct WindowConfig {
pub title: Option<String>,
/// Window class
- #[serde(deserialize_with = "failure_default")]
- pub class: Option<String>,
+ #[serde(deserialize_with = "from_string_or_deserialize")]
+ pub class: Class,
+
+ /// GTK theme variant
+ #[serde(deserialize_with = "option_explicit_none")]
+ pub gtk_theme_variant: Option<String>,
/// TODO: DEPRECATED
#[serde(deserialize_with = "failure_default")]
@@ -117,3 +122,23 @@ impl Dimensions {
self.columns.0 as u32
}
}
+
+/// Window class hint
+#[serde(default)]
+#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
+pub struct Class {
+ pub instance: String,
+ pub general: String
+}
+
+impl Default for Class {
+ fn default() -> Self {
+ Class { instance: DEFAULT_NAME.into(), general: DEFAULT_NAME.into() }
+ }
+}
+
+impl FromString for Class {
+ fn from(value: String) -> Self {
+ Class { instance: value, general: DEFAULT_NAME.into() }
+ }
+}