Skip to content
Open
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
4 changes: 2 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ default-features = false

[workspace.dependencies.cosmic-comp-config]
git = "https://github.com/pop-os/cosmic-comp"
branch = "a11y-zoom_noble"
default-features = false

[workspace.dependencies.cosmic-greeter-config]
Expand Down
3 changes: 2 additions & 1 deletion daemon/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub use cosmic_bg_config::Color;
pub use cosmic_comp_config::XkbConfig;
pub use cosmic_comp_config::{XkbConfig, ZoomConfig};
pub use cosmic_theme::Theme;

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
Expand All @@ -11,6 +11,7 @@ pub struct UserData {
pub theme_opt: Option<Theme>,
pub wallpapers_opt: Option<Vec<(String, WallpaperData)>>,
pub xkb_config_opt: Option<XkbConfig>,
pub zoom_config_opt: Option<ZoomConfig>,
pub clock_military_time: bool,
// pub clock_show_seconds: bool,
}
Expand Down
3 changes: 3 additions & 0 deletions daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ impl GreeterProxy {
//TODO: should wallpapers come from a per-user call?
wallpapers_opt: None,
xkb_config_opt: None,
zoom_config_opt: None,
clock_military_time: false,
// clock_show_seconds: false,
};
Expand Down Expand Up @@ -201,10 +202,12 @@ impl GreeterProxy {
Ok(config_handler) => match CosmicCompConfig::get_entry(&config_handler) {
Ok(config) => {
user_data.xkb_config_opt = Some(config.xkb_config);
user_data.zoom_config_opt = Some(config.accessibility_zoom);
}
Err((errs, config)) => {
log::error!("errors loading cosmic-comp config: {:?}", errs);
user_data.xkb_config_opt = Some(config.xkb_config);
user_data.zoom_config_opt = Some(config.accessibility_zoom);
}
},
Err(err) => {
Expand Down
28 changes: 28 additions & 0 deletions src/greeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn user_data_fallback() -> Vec<UserData> {
theme_opt: None,
wallpapers_opt: None,
xkb_config_opt: None,
zoom_config_opt: None,
clock_military_time: false,
// clock_show_seconds: false,
}
Expand Down Expand Up @@ -480,6 +481,30 @@ impl App {
}
}

fn set_zoom_config(&self) {
let user_data = match self
.selected_username
.data_idx
.and_then(|i| self.flags.user_datas.get(i))
{
Some(some) => some,
None => return,
};

if let Some(zoom_config) = user_data
.zoom_config_opt
.clone()
.or_else(|| Default::default())
{
if let Some(comp_config_handler) = &self.flags.comp_config_handler {
match comp_config_handler.set("accessibility_zoom", zoom_config) {
Ok(()) => log::info!("updated cosmic-comp zoom_config"),
Err(err) => log::error!("failed to update cosmic-comp zoom_config: {}", err),
}
}
}
}

fn update_user_config(&mut self) -> Command<Message> {
let user_data = match self
.selected_username
Expand Down Expand Up @@ -570,6 +595,9 @@ impl App {

// Ensure that user's xkb config is used
self.set_xkb_config();

// Set zoom according to user's config
self.set_zoom_config();
}
}

Expand Down