fix(cli): respect --bar flag in start even when no config is resolved

I think this got broken as part of the automatic Rust version syntax
upgrades which joined two if clauses together with && which should have
been kept separate.

Now, if the user gives the --bar flag to the start command, and a static
config file is not resolved, or if the static config file does not have
a bar_configurations stanza, it will fallthrough to the default
PowerShell snippet to try and start komorebi-bar without an explicit
--config flag.
This commit is contained in:
LGUG2Z
2026-01-03 16:55:56 -08:00
parent 51e1337f40
commit 086993a7c0

View File

@@ -2520,27 +2520,37 @@ if (!(Get-Process whkd -ErrorAction SilentlyContinue))
komorebi_json.is_file().then_some(komorebi_json) komorebi_json.is_file().then_some(komorebi_json)
}); });
if args.bar if args.bar {
&& let Some(config) = &static_config let mut fallthrough = false;
{ match static_config {
let mut config = StaticConfig::read(config)?; None => {
if let Some(display_bar_configurations) = &mut config.bar_configurations { fallthrough = true;
for config_file_path in &mut *display_bar_configurations { }
let script = format!( Some(ref config) => {
r#"Start-Process "komorebi-bar" '"--config" "{}"' -WindowStyle hidden"#, let mut config = StaticConfig::read(config)?;
config_file_path.to_string_lossy() if let Some(display_bar_configurations) = &mut config.bar_configurations {
); for config_file_path in &mut *display_bar_configurations {
let script = format!(
r#"Start-Process "komorebi-bar" '"--config" "{}"' -WindowStyle hidden"#,
config_file_path.to_string_lossy()
);
match powershell_script::run(&script) { match powershell_script::run(&script) {
Ok(_) => { Ok(_) => {
println!("{script}"); println!("{script}");
} }
Err(error) => { Err(error) => {
println!("Error: {error}"); println!("Error: {error}");
}
}
} }
} else {
fallthrough = true;
} }
} }
} else { }
if fallthrough {
let script = r" let script = r"
if (!(Get-Process komorebi-bar -ErrorAction SilentlyContinue)) if (!(Get-Process komorebi-bar -ErrorAction SilentlyContinue))
{ {