diff --git a/wezterm-input-types/src/lib.rs b/wezterm-input-types/src/lib.rs index cb4e56503..012e58fbf 100644 --- a/wezterm-input-types/src/lib.rs +++ b/wezterm-input-types/src/lib.rs @@ -1271,7 +1271,7 @@ impl KeyEvent { bitflags! { #[derive(Deserialize, Serialize, FromDynamic, ToDynamic)] #[serde(try_from = "String")] - #[dynamic(try_from = "String")] + #[dynamic(try_from = "String", into = "String")] pub struct WindowDecorations: u8 { const TITLE = 1; const RESIZE = 2; @@ -1283,6 +1283,28 @@ bitflags! { } } +impl Into for &WindowDecorations { + fn into(self) -> String { + let mut s = vec![]; + if self.contains(WindowDecorations::TITLE) { + s.push("TITLE"); + } + if self.contains(WindowDecorations::RESIZE) { + s.push("RESIZE"); + } + if self.contains(WindowDecorations::MACOS_FORCE_ENABLE_SHADOW) { + s.push("MACOS_FORCE_ENABLE_SHADOW"); + } else if self.contains(WindowDecorations::MACOS_FORCE_DISABLE_SHADOW) { + s.push("MACOS_FORCE_DISABLE_SHADOW"); + } + if s.is_empty() { + "NONE".to_string() + } else { + s.join("|") + } + } +} + impl TryFrom for WindowDecorations { type Error = String; fn try_from(s: String) -> std::result::Result {