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

@ -280,7 +280,7 @@ impl ConfigProxy {
pub fn configure(&self, reload: bool) {
self.send(&ServerMessage::Features {
features: vec![ServerFeature::MOD_MASK],
features: vec![ServerFeature::MOD_MASK, ServerFeature::SHOW_WORKSPACE_ON],
});
self.send(&ServerMessage::Configure { reload });
}

View file

@ -1006,10 +1006,16 @@ impl ConfigProxyHandler {
Ok(())
}
fn handle_show_workspace(&self, seat: Seat, ws: Workspace) -> Result<(), CphError> {
fn handle_show_workspace(
&self,
seat: Seat,
ws: Workspace,
output: Option<Connector>,
) -> Result<(), CphError> {
let seat = self.get_seat(seat)?;
let name = self.get_workspace(ws)?;
self.state.show_workspace(&seat, &name);
let output = output.map(|o| self.get_output_node(o)).transpose()?;
self.state.show_workspace(&seat, &name, output);
Ok(())
}
@ -2725,7 +2731,7 @@ impl ConfigProxyHandler {
}
ClientMessage::GetWorkspace { name } => self.handle_get_workspace(name),
ClientMessage::ShowWorkspace { seat, workspace } => self
.handle_show_workspace(seat, workspace)
.handle_show_workspace(seat, workspace, None)
.wrn("show_workspace")?,
ClientMessage::SetSeatWorkspace { seat, workspace } => self
.handle_set_seat_workspace(seat, workspace)
@ -3203,6 +3209,13 @@ impl ConfigProxyHandler {
ClientMessage::SetClientMatcherBoundingCapabilities { matcher, caps } => self
.handle_set_client_matcher_bounding_capabilities(matcher, caps)
.wrn("set_client_matcher_bounding_capabilities")?,
ClientMessage::ShowWorkspaceOn {
seat,
workspace,
connector,
} => self
.handle_show_workspace(seat, workspace, Some(connector))
.wrn("show_workspace_on")?,
}
Ok(())
}

View file

@ -906,11 +906,16 @@ impl State {
}
}
pub fn show_workspace(&self, seat: &Rc<WlSeatGlobal>, name: &str) {
pub fn show_workspace(
&self,
seat: &Rc<WlSeatGlobal>,
name: &str,
output: Option<Rc<OutputNode>>,
) {
let ws = match self.workspaces.get(name) {
Some(ws) => ws,
_ => {
let output = seat.get_output();
let output = output.unwrap_or_else(|| seat.get_output());
if output.is_dummy {
log::warn!("Not showing workspace because seat is on dummy output");
return;