macos: hide Reenable warning row once Accessibility is granted

The yellow "input capture is disabled" / "input emulation is disabled"
rows were showing simultaneously with the Relaunch toast after a
live AX grant, double-prompting the user for the same action.

Gate the warning row visibility on Accessibility actually being
missing: when AX is granted but capture/emulation remain inactive,
we're in the pending-relaunch state and the Relaunch toast is the
authoritative prompt. Trigger a status refresh from the AX watcher
so the rows hide the instant AX flips to granted, not when the
daemon next reports status.

On non-macOS platforms the visibility logic is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jon Kinney
2026-04-24 08:54:23 -05:00
committed by Ferdinand Schober
parent 8a444f98dd
commit 2dc9ebb6cd
2 changed files with 28 additions and 3 deletions

View File

@@ -450,14 +450,33 @@ impl Window {
self.update_capture_emulation_status();
}
#[cfg(target_os = "macos")]
pub(super) fn refresh_capture_emulation_status(&self) {
self.update_capture_emulation_status();
}
fn update_capture_emulation_status(&self) {
let capture = self.imp().capture_active.get();
let emulation = self.imp().emulation_active.get();
self.imp().capture_status_row.set_visible(!capture);
self.imp().emulation_status_row.set_visible(!emulation);
// On macOS the yellow "Reenable" row only makes sense when
// Accessibility is actually missing. When AX is granted but
// capture/emulation are still off, the daemon simply hasn't been
// restarted yet — the Relaunch toast covers that state, and a
// yellow "grant permission" warning on top of it would be
// redundant and confusing.
#[cfg(target_os = "macos")]
let show_warning = !crate::macos_privacy::accessibility_granted();
#[cfg(not(target_os = "macos"))]
let show_warning = true;
let show_capture_row = !capture && show_warning;
let show_emulation_row = !emulation && show_warning;
self.imp().capture_status_row.set_visible(show_capture_row);
self.imp().emulation_status_row.set_visible(show_emulation_row);
self.imp()
.capture_emulation_group
.set_visible(!capture || !emulation);
.set_visible(show_capture_row || show_emulation_row);
}
pub(super) fn set_authorized_keys(&self, fingerprints: HashMap<String, String>) {