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()
|
.flatten()
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_move_workspace_cmd(
|
fn run_move_workspace_cmd(
|
||||||
workspaces: &[String],
|
workspaces: &[String],
|
||||||
monitor: &str,
|
monitor: &str,
|
||||||
@ -51,8 +52,9 @@ fn run_move_workspace_cmd(
|
|||||||
workspaces
|
workspaces
|
||||||
.iter()
|
.iter()
|
||||||
.map(|workspace| {
|
.map(|workspace| {
|
||||||
let s = format!(r#"'[workspace="{monitor}"]'"#);
|
let s = format!(r#"[workspace="{workspace}"]"#);
|
||||||
let args = vec!["i3-msg", &s, "move", "workspace", "to", workspace];
|
let args = vec!["i3-msg", &s, "move", "workspace", "to", "output", monitor];
|
||||||
|
println!("{}", args.join(" "));
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
Command::new("echo").args(args).output()
|
Command::new("echo").args(args).output()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
11
src/main.rs
11
src/main.rs
@ -56,10 +56,17 @@ fn main() -> Result<()> {
|
|||||||
let cmd = run_cmd(&map, &cfg)?;
|
let cmd = run_cmd(&map, &cfg)?;
|
||||||
println!("cmd {:#?}", cmd);
|
println!("cmd {:#?}", cmd);
|
||||||
// TODO(wathiede): run xrandr --output $DPY --primary
|
// TODO(wathiede): run xrandr --output $DPY --primary
|
||||||
// TODO(wathiede): i3-msg to move workspaces to proper places.
|
|
||||||
let res = swap_workspaces(&cfg)?;
|
let res = swap_workspaces(&cfg)?;
|
||||||
for r in res {
|
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(())
|
Ok(())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user