atagen

monolith

public
Star0
Watch0

Commit adcf397e4f74

tarball

atagen <boss@atagen.co>2026-10-18 09:56 UTC

1 file changed+4-6
layout: keep focus on the active output

focused() searched every output while active only moved on an explicit focus, so hiding or closing the last focused window on one output put focus and the pointer on another while keybinds still acted on the first. Focus now falls back only within the active output, which stays the output where a window was last selected.
Modified file: crates/layout/src/lib.rs+4 additions−6 deletions
@@ -412,13 +412,11 @@ impl Layout {
412412 self.history.push(w);
413413 }
414414
415- /// The most recently focused visible window.
415+ /// The most recently focused visible window on the active output. Focus
416+ /// falling back to another output would leave keybinds acting on one
417+ /// output while the keyboard and pointer sit on another.
416418 pub fn focused(&self) -> Option<WindowId> {
417- self.history
418- .iter()
419- .rev()
420- .copied()
421- .find(|&w| self.visible(w))
419+ self.focused_on(self.active?)
422420 }
423421
424422 /// The most recently focused visible window on `o`.