1
0
Fork 0
forked from wry/wry

config: add Seat::show_workspace_on

This commit is contained in:
Julian Orth 2025-10-07 05:02:07 +02:00
parent d2ce140f54
commit d320d2f3c1
12 changed files with 131 additions and 13 deletions

View file

@ -88,6 +88,8 @@ pub enum ActionParserError {
JumpToMark(#[source] MarkIdParserError),
#[error("Could not parse a copy-mark action")]
CopyMark(#[source] MarkIdParserError),
#[error("Could not parse a show-workspace action")]
ShowWorkspace(#[source] OutputMatchParserError),
}
pub struct ActionParser<'a>(pub &'a Context<'a>);
@ -184,8 +186,15 @@ impl ActionParser<'_> {
}
fn parse_show_workspace(&mut self, ext: &mut Extractor<'_>) -> ParseResult<Self> {
let name = ext.extract(str("name"))?.value.to_string();
Ok(Action::ShowWorkspace { name })
let (name, output) = ext.extract((str("name"), opt(val("output"))))?;
let name = name.value.to_string();
let output = output
.map(|o| {
o.parse_map(&mut OutputMatchParser(self.0))
.map_spanned_err(ActionParserError::ShowWorkspace)
})
.transpose()?;
Ok(Action::ShowWorkspace { name, output })
}
fn parse_move_to_workspace(&mut self, ext: &mut Extractor<'_>) -> ParseResult<Self> {