fix: clear sticky windows, or floating windows focus hint if focus moves

This commit is contained in:
Hojjat 2026-09-09 14:57:29 -06:00 • committed by Victoria Brekenfeld
parent 0fbd4574ef
commit 6645edff64
4 changed files with 40 additions and 10 deletions

View file

@ -430,6 +430,10 @@ impl CosmicMapped {
} }
} }
pub fn is_sticky(&self) -> bool {
self.active_window().is_sticky()
}
pub fn pending_size(&self) -> Option<Size<i32, Logical>> { pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
match &self.element { match &self.element {
CosmicMappedInternal::Stack(s) => s.pending_size(), CosmicMappedInternal::Stack(s) => s.pending_size(),

View file

@ -255,8 +255,17 @@ impl Shell {
let workspace = if let Some(workspace) = workspace { let workspace = if let Some(workspace) = workspace {
self.workspaces.space_for_handle_mut(&workspace.0).unwrap() self.workspaces.space_for_handle_mut(&workspace.0).unwrap()
} else { } else {
//should this be the active output or the focused output? let output = match &target {
self.active_space_mut(&seat.focused_or_active_output()) FocusTarget::Window(mapped) => self
.workspaces
.sets
.iter()
.find(|(_, set)| set.sticky_layer.mapped().any(|m| m == mapped))
.map(|(output, _)| output.clone()),
FocusTarget::Fullscreen(_) => None,
};
self.active_space_mut(&output.unwrap_or_else(|| seat.active_output()))
.unwrap() .unwrap()
}; };

View file

@ -516,6 +516,12 @@ impl WorkspaceSet {
} }
} }
fn refresh_focus_stacks(&mut self) {
for workspace in &mut self.workspaces {
workspace.refresh_focus_stack();
}
}
fn activate( fn activate(
&mut self, &mut self,
idx: usize, idx: usize,
@ -620,6 +626,7 @@ impl WorkspaceSet {
self.workspaces[self.active].refresh(); self.workspaces[self.active].refresh();
} }
self.sticky_layer.refresh(); self.sticky_layer.refresh();
self.refresh_focus_stacks();
} }
fn add_empty_workspace(&mut self, state: &mut WorkspaceUpdateGuard<State>) { fn add_empty_workspace(&mut self, state: &mut WorkspaceUpdateGuard<State>) {

View file

@ -526,10 +526,16 @@ impl Workspace {
.mapped() .mapped()
.chain(self.tiling_layer.mapped().map(|(w, _)| w)) .chain(self.tiling_layer.mapped().map(|(w, _)| w))
.chain(move_mapped.iter()) .chain(move_mapped.iter())
.chain(
self.minimized_windows
.iter()
.flat_map(MinimizedWindow::mapped),
)
}; };
stack.retain(|w| match w { stack.retain(|w| match w {
FocusTarget::Fullscreen(s) => fullscreen_surfaces.contains(&s), FocusTarget::Fullscreen(s) => fullscreen_surfaces.contains(&s),
FocusTarget::Window(w) => mapped().any(|m| w == m), // Sticky windows live in the `WorkspaceSet` but are shown on whichever workspace is current
FocusTarget::Window(w) => w.is_sticky() || mapped().any(|m| w == m),
}); });
} }
} }
@ -1767,13 +1773,17 @@ impl Workspace {
self.floating_layer.render( self.floating_layer.render(
renderer, renderer,
focused.as_ref().and_then(|target| { render_focus
if let FocusTarget::Window(mapped) = target { .then(|| {
Some(mapped) focused.as_ref().and_then(|target| {
} else { if let FocusTarget::Window(mapped) = target {
None Some(mapped)
} } else {
}), None
}
})
})
.flatten(),
resize_indicator.clone(), resize_indicator.clone(),
indicator_thickness, indicator_thickness,
alpha, alpha,