fix: alt-tab focus history MRU ordering, repeat handling, and quick release

This commit is contained in:
2026-09-09 12:39:10 +02:00
parent 50caed0110
commit 53cebf14f3
5 changed files with 131 additions and 91 deletions
+3 -14
View File
@@ -65,6 +65,7 @@ pub struct Settings {
/// the overlay maps there rather than wherever the compositor would put it.
pub scale: i32,
pub output: String,
#[allow(dead_code)]
pub alt_tab: AltTabMode,
}
@@ -123,10 +124,7 @@ pub struct App {
pub(crate) seat: Option<WlSeat>,
pub(crate) inhibit_mgr: Option<ZwpKeyboardShortcutsInhibitManagerV1>,
pub(crate) inhibitor: Option<ZwpKeyboardShortcutsInhibitorV1>,
pub(crate) alt_tab: AltTabMode,
pub(crate) is_alt_tab: bool,
pub(crate) latched_modifiers: std::collections::BTreeSet<u32>,
pub(crate) initial_stepped: bool,
/// The navigation key currently held down, and when the next repeat fires.
pub(crate) repeat_key: Option<u32>,
@@ -188,15 +186,9 @@ impl App {
fps,
scale,
output,
alt_tab,
..
} = settings;
let focused_idx = targets.iter().position(|t| t.focused).unwrap_or(0);
let sel = if alt_tab == AltTabMode::Yes && targets.len() > 1 {
(focused_idx + 1) % targets.len()
} else {
focused_idx
};
let is_alt_tab = alt_tab == AltTabMode::Yes;
let sel = if targets.len() > 1 { 1 } else { 0 };
// Bind everything up front so a compositor missing a protocol fails
// here, with a name, rather than halfway through a capture.
let mut app = Self {
@@ -237,10 +229,7 @@ impl App {
seat: None,
inhibit_mgr: None,
inhibitor: None,
alt_tab,
is_alt_tab,
latched_modifiers: std::collections::BTreeSet::new(),
initial_stepped: alt_tab == AltTabMode::Yes,
repeat_key: None,
repeat_next: None,
repeat_delay_ms: 600,