Skip to content
10 changes: 9 additions & 1 deletion niri-ipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,15 @@ impl FromStr for WorkspaceReferenceArg {
return Err("workspace index must be between 0 and 255");
}
} else {
Self::Name(s.to_string())
if let Some(target_id) = s.strip_prefix("id:") {
if let Ok(wid) = target_id.parse::<u64>() {
Self::Id(wid)
} else {
return Err("workspace id must be integer");
}
} else {
Self::Name(s.to_string())
}
};

Ok(reference)
Expand Down
3 changes: 2 additions & 1 deletion src/ipc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,13 @@ pub fn handle_msg(mut msg: Msg, json: bool) -> anyhow::Result<()> {

let is_active = if ws.is_active { " * " } else { " " };
let idx = ws.idx;
let wid = ws.id;
let name = if let Some(name) = ws.name.as_deref() {
format!(" \"{name}\"")
} else {
String::new()
};
println!("{is_active}{idx}{name}");
println!("{is_active}{idx}\t{wid}\t{name}");
}
}
Msg::KeyboardLayouts => {
Expand Down