Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions cosmic-settings/src/pages/accessibility/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use cosmic::iced::stream;
use cosmic::theme::CosmicTheme;
use cosmic::widget::{dropdown, settings, text};
use cosmic::{Apply, Element, Task, surface};
use cosmic_comp_config::CosmicCompConfig;
pub use cosmic_comp_config::ZoomMovement;
use cosmic_config::CosmicConfigEntry;
use cosmic_settings_a11y_manager_subscription as cosmic_a11y_manager;
Expand Down Expand Up @@ -36,11 +37,21 @@ pub struct Page {
daemon_helper: cosmic_config::Config,
dbus_sender: Option<UnboundedSender<a11y_bus::Request>>,
reader_enabled: bool,
comp_config: CosmicCompConfig,
comp_helper: cosmic_config::Config,
}

impl Default for Page {
fn default() -> Self {
let daemon_helper = CosmicSettingsDaemonConfig::config().unwrap();
let comp_helper = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
let comp_config =
CosmicCompConfig::get_entry(&comp_helper).unwrap_or_else(|(errs, config)| {
for err in errs {
tracing::warn!(?err, "error while reading cosmic-comp config");
}
config
});
Page {
dbus_sender: None,
entity: page::Entity::default(),
Expand All @@ -65,6 +76,8 @@ impl Default for Page {
.unwrap_or_default(),
daemon_helper,
reader_enabled: false,
comp_config,
comp_helper,
}
}
}
Expand All @@ -77,6 +90,7 @@ pub enum Message {
ProtocolUnavailable,
Return,
ScreenReaderEnabled(bool),
SetCursorShakeToFind(bool),
SetScreenFilterActive(bool),
SetScreenFilterSelection(ColorFilter),
SetScreenInverted(bool),
Expand Down Expand Up @@ -187,6 +201,8 @@ pub fn vision() -> section::Section<crate::pages::Message> {
invert_colors = fl!("accessibility", "invert-colors");
color_filters = fl!("accessibility", "color-filters");
color_filter_type = fl!("color-filter");
shake_cursor = fl!("accessibility", "shake-cursor");
shake_cursor_desc = fl!("accessibility", "shake-cursor-desc");
});

Section::default()
Expand Down Expand Up @@ -276,6 +292,13 @@ pub fn vision() -> section::Section<crate::pages::Message> {

settings::item::builder(&descriptions[color_filter_type]).control(dropdown)
})
.add(
settings::item::builder(&descriptions[shake_cursor])
.description(&descriptions[shake_cursor_desc])
.toggler(page.comp_config.cursor_shake_to_find, |enabled| {
Message::SetCursorShakeToFind(enabled).into()
}),
)
.into()
})
}
Expand Down Expand Up @@ -416,6 +439,14 @@ impl Page {
Message::Surface(a) => {
return cosmic::task::message(crate::app::Message::Surface(a));
}
Message::SetCursorShakeToFind(enabled) => {
if let Err(err) = self
.comp_config
.set_cursor_shake_to_find(&self.comp_helper, enabled)
{
tracing::error!(?err, "failed to set cursor_shake_to_find");
}
}
Message::SetSoundMono(active) => {
if let Err(err) = self
.daemon_config
Expand Down
2 changes: 2 additions & 0 deletions i18n/en/cosmic_settings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ accessibility = Accessibility
.high-contrast = High contrast mode
.invert-colors = Invert colors
.color-filters = Color filters
.shake-cursor = Shake pointer to find it
.shake-cursor-desc = Quickly shake the mouse to temporarily enlarge the pointer

hearing = Hearing
.mono = Play stereo audio as mono
Expand Down