feat(config): soft deprecate window_hiding_behaviour variants

This commit adds a soft-deprecation message for the Hide and Minimize
variants of WindowHidingBehaviour to start bringing all users towards
using the Cloak variant.

resolve #897
This commit is contained in:
LGUG2Z
2024-07-04 11:36:29 -07:00
parent a5735c4186
commit cc7dbde049
2 changed files with 16 additions and 4 deletions

View File

@@ -356,7 +356,7 @@ pub enum HidingBehaviour {
Hide,
/// Use the SW_MINIMIZE flag to hide windows when switching workspaces (has issues with frequent workspace switching)
Minimize,
/// Use the undocumented SetCloak Win32 function to hide windows when switching workspaces (has foregrounding issues)
/// Use the undocumented SetCloak Win32 function to hide windows when switching workspaces
Cloak,
}

View File

@@ -299,7 +299,7 @@ pub struct StaticConfig {
/// Monitor and workspace configurations
#[serde(skip_serializing_if = "Option::is_none")]
pub monitors: Option<Vec<MonitorConfig>>,
/// Which Windows signal to use when hiding windows (default: minimize)
/// Which Windows signal to use when hiding windows (default: Cloak)
#[serde(skip_serializing_if = "Option::is_none")]
pub window_hiding_behaviour: Option<HidingBehaviour>,
/// Global work area (space used for tiling) offset (default: None)
@@ -366,13 +366,25 @@ impl StaticConfig {
}
pub fn deprecated(raw: &str) {
let deprecated = ["invisible_borders"];
let deprecated_options = ["invisible_borders"];
let deprecated_variants = vec![
("Hide", "window_hiding_behaviour", "Cloak"),
("Minimize", "window_hiding_behaviour", "Cloak"),
];
for option in deprecated {
for option in deprecated_options {
if raw.contains(option) {
println!(r#""{option}" is deprecated and can be removed"#);
}
}
for (variant, option, recommended) in deprecated_variants {
if raw.contains(option) && raw.contains(variant) {
println!(
r#"The "{variant}" option for "{option}" is deprecated and can be removed or replaced with "{recommended}""#
);
}
}
}
}