zoom: Localize zoom ui

This commit is contained in:
Victoria Brekenfeld 2025-02-14 19:14:18 +01:00 committed by Victoria Brekenfeld
parent 3cff46d7e5
commit d30671c984
3 changed files with 99 additions and 20 deletions

View file

@ -1,5 +1,27 @@
a11y-zoom-move-continuously = Ansicht bewegt kontinuierlich sich mit dem Cursor
a11y-zoom-move-onedge = Ansicht bewegt sich an den Rändern
a11y-zoom-move-centered = Ansicht hält Cursor zentriert
a11y-zoom-settings = Bildschirmlupe-Einstellungen...
grow-window = Vergrößern grow-window = Vergrößern
shrink-window = Verkleinern shrink-window = Verkleinern
swap-windows = Fenster tauschen swap-windows = Fenster tauschen
stack-windows = Fenster stapeln stack-windows = Fenster stapeln
unknown-keybinding = <nicht zugewiesen> unknown-keybinding = <nicht zugewiesen>
window-menu-minimize = Minimieren
window-menu-maximize = Maximieren
window-menu-tiled = Schwebendes Fenster
window-menu-screenshot = Bildschirmfoto aufnehmen
window-menu-move = Bewegen
window-menu-resize = Größe anpassen
window-menu-move-prev-workspace = Zur vorherigen Arbeitsfläche verschieben
window-menu-move-next-workspace = Zur nächsten Arbeitsfläche verschieben
window-menu-stack = Fensterstapel erstellen
window-menu-unstack-all = Fensterstapel auflösen
window-menu-unstack = Fenster aus Stapel lösen
window-menu-sticky = Klebendes Fenster
window-menu-close = Schließen
window-menu-close-all = Schließe alle Fenster
window-menu-resize-edge-top = Oben
window-menu-resize-edge-left = Links
window-menu-resize-edge-right = Rechts
window-menu-resize-edge-bottom = Unten

View file

@ -1,3 +1,7 @@
a11y-zoom-move-continuously = View moves continuously with pointer
a11y-zoom-move-onedge = View moves when pointer reaches edge
a11y-zoom-move-centered = View moves to keep pointer centered
a11y-zoom-settings = Magnifier settings...
grow-window = Grow grow-window = Grow
shrink-window = Shrink shrink-window = Shrink
swap-windows = Swap Windows swap-windows = Swap Windows

View file

@ -8,6 +8,7 @@ use cosmic::{
Apply, Apply,
}; };
use cosmic_comp_config::ZoomMovement; use cosmic_comp_config::ZoomMovement;
use cosmic_config::ConfigSet;
use keyframe::{ease, functions::EaseInOutCubic}; use keyframe::{ease, functions::EaseInOutCubic};
use smithay::{ use smithay::{
backend::renderer::{element::AsRenderElements, ImportMem, Renderer}, backend::renderer::{element::AsRenderElements, ImportMem, Renderer},
@ -28,6 +29,7 @@ use smithay::{
output::Output, output::Output,
utils::{IsAlive, Point, Rectangle, Serial, Size}, utils::{IsAlive, Point, Rectangle, Serial, Size},
}; };
use tracing::error;
use crate::{ use crate::{
state::State, state::State,
@ -549,21 +551,38 @@ impl Program for ZoomProgram {
start_data, start_data,
&seat, &seat,
vec![ vec![
Item::new("View moves with pointer", move |handle| { Item::new(
let _ = handle.insert_idle(move |state| { crate::fl!("a11y-zoom-move-continuously"),
state move |handle| {
.common let _ = handle.insert_idle(move |state| {
.config state
.cosmic_conf .common
.accessibility_zoom .config
.view_moves = ZoomMovement::Continuously; .cosmic_conf
state.common.update_config(); .accessibility_zoom
// TODO: Write config .view_moves = ZoomMovement::Continuously;
}); 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();
}
});
},
)
.toggled(movement == ZoomMovement::Continuously), .toggled(movement == ZoomMovement::Continuously),
Item::new( Item::new(
"View moves when pointer reaches edge", crate::fl!("a11y-zoom-move-onedge"),
move |handle| { move |handle| {
let _ = handle.insert_idle(move |state| { let _ = handle.insert_idle(move |state| {
state state
@ -572,14 +591,28 @@ impl Program for ZoomProgram {
.cosmic_conf .cosmic_conf
.accessibility_zoom .accessibility_zoom
.view_moves = ZoomMovement::OnEdge; .view_moves = ZoomMovement::OnEdge;
state.common.update_config(); if let Err(err) =
// TODO: Write config 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();
}
}); });
}, },
) )
.toggled(movement == ZoomMovement::OnEdge), .toggled(movement == ZoomMovement::OnEdge),
Item::new( Item::new(
"View moves to keep pointer centered", crate::fl!("a11y-zoom-move-centered"),
move |handle| { move |handle| {
let _ = handle.insert_idle(move |state| { let _ = handle.insert_idle(move |state| {
state state
@ -588,13 +621,33 @@ impl Program for ZoomProgram {
.cosmic_conf .cosmic_conf
.accessibility_zoom .accessibility_zoom
.view_moves = ZoomMovement::Centered; .view_moves = ZoomMovement::Centered;
state.common.update_config(); if let Err(err) =
// TODO: Write config 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();
}
}); });
}, },
) )
.toggled(movement == ZoomMovement::Centered), .toggled(movement == ZoomMovement::Centered),
Item::new("Magnifier settings...", |_| { /* TODO */ }), Item::new(crate::fl!("a11y-zoom-settings"), |handle| {
let _ = handle.insert_idle(move |state| {
state.spawn_command(
"cosmic-settings page-accessibility".into(),
);
});
}),
] ]
.into_iter(), .into_iter(),
position.to_global(&output).to_i32_round(), position.to_global(&output).to_i32_round(),