a11y/zoom: Allow hiding the overlay

This commit is contained in:
Victoria Brekenfeld 2025-03-25 14:38:35 +01:00 committed by Victoria Brekenfeld
parent b0d0bfb034
commit b62e47ef8d
4 changed files with 19 additions and 15 deletions

View file

@ -130,6 +130,7 @@ fn default_repeat_delay() -> u32 {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
pub struct ZoomConfig {
pub start_on_login: bool,
pub show_overlay: bool,
pub increment: u32,
pub view_moves: ZoomMovement,
}
@ -138,6 +139,7 @@ impl Default for ZoomConfig {
fn default() -> Self {
ZoomConfig {
start_on_login: false,
show_overlay: true,
increment: 50,
view_moves: ZoomMovement::Continuously,
}

View file

@ -73,7 +73,7 @@ fn render_input_order_internal<R: 'static>(
if shell
.zoom_state
.as_ref()
.is_some_and(|state| state.current_level() != 1.0)
.is_some_and(|state| state.show_overlay && state.current_level() != 1.0)
{
callback(Stage::ZoomUI)?;
}

View file

@ -1249,6 +1249,7 @@ impl Common {
if let Some(zoom_state) = shell_ref.zoom_state.as_mut() {
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
zoom_state.show_overlay = self.config.cosmic_conf.accessibility_zoom.show_overlay;
for output in shell_ref.workspaces.sets.keys() {
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
@ -2051,6 +2052,7 @@ impl Shell {
self.theme.clone(),
);
}
1.
};
@ -2064,6 +2066,7 @@ impl Shell {
self.zoom_state = Some(ZoomState {
seat: seat.clone(),
show_overlay: zoom_config.show_overlay,
level,
increment: zoom_config.increment,
movement: zoom_config.view_moves,

View file

@ -51,6 +51,7 @@ use super::{
#[derive(Debug, Clone)]
pub struct ZoomState {
pub(super) seat: Seat<State>,
pub(super) show_overlay: bool,
pub(super) level: f64,
pub(super) increment: u32,
pub(super) movement: ZoomMovement,
@ -780,21 +781,19 @@ impl Program for ZoomProgram {
}
ZoomMessage::Close => {
let _ = loop_handle.insert_idle(|state| {
let seat = state
state
.common
.shell
.read()
.unwrap()
.seats
.last_active()
.clone();
state.common.shell.write().unwrap().trigger_zoom(
&seat,
1.0,
&state.common.config.cosmic_conf.accessibility_zoom,
true,
&state.common.event_loop_handle,
);
.config
.cosmic_conf
.accessibility_zoom
.show_overlay = false;
if let Err(err) = state.common.config.cosmic_helper.set(
"accessibility_zoom",
state.common.config.cosmic_conf.accessibility_zoom,
) {
error!(?err, "Failed to update zoom config");
}
state.common.update_config();
});
}
ZoomMessage::Update {