feat: add option to toggle shake cursor to find it
This commit is contained in:
parent
2b43c925a0
commit
6e5b09c0d7
2 changed files with 33 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ use cosmic::iced::stream;
|
||||||
use cosmic::theme::CosmicTheme;
|
use cosmic::theme::CosmicTheme;
|
||||||
use cosmic::widget::{dropdown, settings, text};
|
use cosmic::widget::{dropdown, settings, text};
|
||||||
use cosmic::{Apply, Element, Task, surface};
|
use cosmic::{Apply, Element, Task, surface};
|
||||||
|
use cosmic_comp_config::CosmicCompConfig;
|
||||||
pub use cosmic_comp_config::ZoomMovement;
|
pub use cosmic_comp_config::ZoomMovement;
|
||||||
use cosmic_config::CosmicConfigEntry;
|
use cosmic_config::CosmicConfigEntry;
|
||||||
use cosmic_settings_a11y_manager_subscription as cosmic_a11y_manager;
|
use cosmic_settings_a11y_manager_subscription as cosmic_a11y_manager;
|
||||||
|
|
@ -36,11 +37,21 @@ pub struct Page {
|
||||||
daemon_helper: cosmic_config::Config,
|
daemon_helper: cosmic_config::Config,
|
||||||
dbus_sender: Option<UnboundedSender<a11y_bus::Request>>,
|
dbus_sender: Option<UnboundedSender<a11y_bus::Request>>,
|
||||||
reader_enabled: bool,
|
reader_enabled: bool,
|
||||||
|
comp_config: CosmicCompConfig,
|
||||||
|
comp_helper: cosmic_config::Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Page {
|
impl Default for Page {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let daemon_helper = CosmicSettingsDaemonConfig::config().unwrap();
|
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 {
|
Page {
|
||||||
dbus_sender: None,
|
dbus_sender: None,
|
||||||
entity: page::Entity::default(),
|
entity: page::Entity::default(),
|
||||||
|
|
@ -65,6 +76,8 @@ impl Default for Page {
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
daemon_helper,
|
daemon_helper,
|
||||||
reader_enabled: false,
|
reader_enabled: false,
|
||||||
|
comp_config,
|
||||||
|
comp_helper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +90,7 @@ pub enum Message {
|
||||||
ProtocolUnavailable,
|
ProtocolUnavailable,
|
||||||
Return,
|
Return,
|
||||||
ScreenReaderEnabled(bool),
|
ScreenReaderEnabled(bool),
|
||||||
|
SetCursorShakeToFind(bool),
|
||||||
SetScreenFilterActive(bool),
|
SetScreenFilterActive(bool),
|
||||||
SetScreenFilterSelection(ColorFilter),
|
SetScreenFilterSelection(ColorFilter),
|
||||||
SetScreenInverted(bool),
|
SetScreenInverted(bool),
|
||||||
|
|
@ -187,6 +201,8 @@ pub fn vision() -> section::Section<crate::pages::Message> {
|
||||||
invert_colors = fl!("accessibility", "invert-colors");
|
invert_colors = fl!("accessibility", "invert-colors");
|
||||||
color_filters = fl!("accessibility", "color-filters");
|
color_filters = fl!("accessibility", "color-filters");
|
||||||
color_filter_type = fl!("color-filter");
|
color_filter_type = fl!("color-filter");
|
||||||
|
shake_cursor = fl!("accessibility", "shake-cursor");
|
||||||
|
shake_cursor_desc = fl!("accessibility", "shake-cursor-desc");
|
||||||
});
|
});
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
|
|
@ -276,6 +292,13 @@ pub fn vision() -> section::Section<crate::pages::Message> {
|
||||||
|
|
||||||
settings::item::builder(&descriptions[color_filter_type]).control(dropdown)
|
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()
|
.into()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -416,6 +439,14 @@ impl Page {
|
||||||
Message::Surface(a) => {
|
Message::Surface(a) => {
|
||||||
return cosmic::task::message(crate::app::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) => {
|
Message::SetSoundMono(active) => {
|
||||||
if let Err(err) = self
|
if let Err(err) = self
|
||||||
.daemon_config
|
.daemon_config
|
||||||
|
|
|
||||||
2
i18n/en/cosmic_settings.ftl
vendored
2
i18n/en/cosmic_settings.ftl
vendored
|
|
@ -275,6 +275,8 @@ accessibility = Accessibility
|
||||||
.high-contrast = High contrast mode
|
.high-contrast = High contrast mode
|
||||||
.invert-colors = Invert colors
|
.invert-colors = Invert colors
|
||||||
.color-filters = Color filters
|
.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
|
hearing = Hearing
|
||||||
.mono = Play stereo audio as mono
|
.mono = Play stereo audio as mono
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue