Better error printing, fixed argument formatting.
This commit is contained in:
parent
72100921e6
commit
333119a00d
@ -44,6 +44,7 @@ pub fn swap_workspaces(cfg: &Config) -> Result<Vec<Result<Output, CommandError>>
|
||||
.flatten()
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn run_move_workspace_cmd(
|
||||
workspaces: &[String],
|
||||
monitor: &str,
|
||||
@ -51,8 +52,9 @@ fn run_move_workspace_cmd(
|
||||
workspaces
|
||||
.iter()
|
||||
.map(|workspace| {
|
||||
let s = format!(r#"'[workspace="{monitor}"]'"#);
|
||||
let args = vec!["i3-msg", &s, "move", "workspace", "to", workspace];
|
||||
let s = format!(r#"[workspace="{workspace}"]"#);
|
||||
let args = vec!["i3-msg", &s, "move", "workspace", "to", "output", monitor];
|
||||
println!("{}", args.join(" "));
|
||||
if cfg!(debug_assertions) {
|
||||
Command::new("echo").args(args).output()
|
||||
} else {
|
||||
|
||||
11
src/main.rs
11
src/main.rs
@ -56,10 +56,17 @@ fn main() -> Result<()> {
|
||||
let cmd = run_cmd(&map, &cfg)?;
|
||||
println!("cmd {:#?}", cmd);
|
||||
// TODO(wathiede): run xrandr --output $DPY --primary
|
||||
// TODO(wathiede): i3-msg to move workspaces to proper places.
|
||||
let res = swap_workspaces(&cfg)?;
|
||||
for r in res {
|
||||
println!("r = {:?}", r);
|
||||
match r {
|
||||
Ok(r) => println!(
|
||||
"Exit: {}\nStdout:\n{}\nStderr:\n{}",
|
||||
r.status,
|
||||
String::from_utf8_lossy(&r.stdout),
|
||||
String::from_utf8_lossy(&r.stderr)
|
||||
),
|
||||
Err(e) => println!("Error: {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user