refactor: fallback to last active seat for privileged activation token

This commit is contained in:
Ashley Wulber 2025-07-31 13:55:35 -04:00 committed by Victoria Brekenfeld
parent e1aa8f7cb4
commit cd5efd0741

View file

@ -42,7 +42,13 @@ impl XdgActivationHandler for State {
}) })
.unwrap_or(false) .unwrap_or(false)
{ {
if let Some(seat) = data.serial.and_then(|(_, seat)| Seat::from_resource(&seat)) { let seat = data
.serial
.and_then(|(_, seat)| Seat::from_resource(&seat))
.unwrap_or_else(|| {
let shell = self.common.shell.read();
shell.seats.last_active().clone()
});
let output = seat.active_output(); let output = seat.active_output();
let mut shell = self.common.shell.write(); let mut shell = self.common.shell.write();
let workspace = shell.active_space_mut(&output).unwrap(); let workspace = shell.active_space_mut(&output).unwrap();
@ -50,15 +56,6 @@ impl XdgActivationHandler for State {
data.user_data data.user_data
.insert_if_missing(move || ActivationContext::Workspace(handle)); .insert_if_missing(move || ActivationContext::Workspace(handle));
debug!(?token, "created workspace token for privileged client"); debug!(?token, "created workspace token for privileged client");
} else {
data.user_data
.insert_if_missing(|| ActivationContext::UrgentOnly);
debug!(
?token,
"created urgent-only token for privileged client without seat"
);
}
return true; return true;
}; };