feat: sync state with greeter
This commit is contained in:
parent
74e90f793f
commit
b3a67bca50
4 changed files with 125 additions and 10 deletions
94
Cargo.lock
generated
94
Cargo.lock
generated
|
|
@ -826,6 +826,7 @@ dependencies = [
|
|||
"cosmic-config",
|
||||
"cosmic-protocols",
|
||||
"cosmic-settings-config",
|
||||
"cosmic-settings-daemon-config",
|
||||
"cosmic-text",
|
||||
"egui",
|
||||
"egui_plot",
|
||||
|
|
@ -850,7 +851,7 @@ dependencies = [
|
|||
"rand 0.9.1",
|
||||
"regex",
|
||||
"reis",
|
||||
"ron",
|
||||
"ron 0.9.0",
|
||||
"rust-embed",
|
||||
"rustix 0.38.44",
|
||||
"sanitize-filename",
|
||||
|
|
@ -899,7 +900,7 @@ dependencies = [
|
|||
"known-folders",
|
||||
"notify",
|
||||
"once_cell",
|
||||
"ron",
|
||||
"ron 0.9.0",
|
||||
"serde",
|
||||
"tracing",
|
||||
"xdg",
|
||||
|
|
@ -944,10 +945,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-settings-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-settings-daemon#54b4418e1e7757d965166ae9dc00c522aebf4451"
|
||||
source = "git+https://github.com/pop-os/cosmic-settings-daemon#151780eee4262a08ff3abf63d8d7d1c69b575dc0"
|
||||
dependencies = [
|
||||
"cosmic-config",
|
||||
"ron",
|
||||
"ron 0.9.0",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"thiserror 2.0.12",
|
||||
|
|
@ -955,6 +956,17 @@ dependencies = [
|
|||
"xkbcommon 0.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-settings-daemon-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-settings-daemon?branch=greeter#44ae8813ee2cef186a8817377f529801199972c4"
|
||||
dependencies = [
|
||||
"cosmic-config",
|
||||
"cosmic-theme",
|
||||
"ron 0.8.1",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-text"
|
||||
version = "0.14.2"
|
||||
|
|
@ -988,7 +1000,7 @@ dependencies = [
|
|||
"dirs 6.0.0",
|
||||
"lazy_static",
|
||||
"palette",
|
||||
"ron",
|
||||
"ron 0.9.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.12",
|
||||
|
|
@ -1332,6 +1344,12 @@ dependencies = [
|
|||
"linux-raw-sys 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
||||
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.31.1"
|
||||
|
|
@ -4270,6 +4288,26 @@ dependencies = [
|
|||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
|
||||
dependencies = [
|
||||
"ref-cast-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast-impl"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.101",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
|
|
@ -4369,6 +4407,18 @@ dependencies = [
|
|||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"bitflags 2.9.1",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.9.0"
|
||||
|
|
@ -4519,6 +4569,30 @@ dependencies = [
|
|||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.1"
|
||||
|
|
@ -4616,15 +4690,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.12.0"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
|
||||
checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.9.0",
|
||||
"schemars 0.9.0",
|
||||
"schemars 1.0.4",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
|
|
@ -4634,9 +4710,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.12.0"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
|
||||
checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ cosmic-comp-config = {path = "cosmic-comp-config", features = ["libdisplay-info"
|
|||
cosmic-config = {git = "https://github.com/pop-os/libcosmic/", features = ["calloop", "macro"]}
|
||||
cosmic-protocols = {git = "https://github.com/pop-os/cosmic-protocols", rev = "e706814", default-features = false, features = ["server"]}
|
||||
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" }
|
||||
cosmic-settings-daemon-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", branch = "greeter", features = ["greeter"] }
|
||||
cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git", features = ["shape-run-cache"] }
|
||||
libdisplay-info = "0.2.0"
|
||||
egui = {version = "0.31.0", optional = true}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::State;
|
||||
use crate::wayland::protocols::a11y::A11yHandler;
|
||||
use crate::{config::ScreenFilter, state::State};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use cosmic_comp_config::NumlockState;
|
||||
use cosmic_config::CosmicConfigEntry;
|
||||
use cosmic_settings_daemon_config::greeter;
|
||||
use smithay::reexports::{calloop::EventLoop, wayland_server::DisplayHandle};
|
||||
use tracing::{info, warn};
|
||||
|
||||
|
|
@ -70,6 +73,37 @@ pub fn init_backend_auto(
|
|||
.seats
|
||||
.add_seat(initial_seat.clone());
|
||||
|
||||
let helper = greeter::GreeterAccessibilityState::config()?;
|
||||
let greeter_state = match greeter::GreeterAccessibilityState::get_entry(&helper) {
|
||||
Ok(s) => s,
|
||||
Err((errs, s)) => {
|
||||
for err in errs {
|
||||
tracing::error!("Error loading greeter state: {err:?}");
|
||||
}
|
||||
s
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(magnifier) = greeter_state.magnifier {
|
||||
let mut zoom = state.common.config.cosmic_conf.accessibility_zoom;
|
||||
|
||||
zoom.start_on_login = magnifier;
|
||||
if let Err(err) = state
|
||||
.common
|
||||
.config
|
||||
.cosmic_conf
|
||||
.set_accessibility_zoom(&state.common.config.cosmic_helper, zoom)
|
||||
{
|
||||
tracing::error!("Failed to set screen filter: {err:?}");
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(inverted) = greeter_state.invert_colors {
|
||||
if inverted != state.a11y_state().screen_inverted() {
|
||||
state.request_screen_invert(inverted);
|
||||
}
|
||||
}
|
||||
|
||||
if state
|
||||
.common
|
||||
.config
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ impl A11yState {
|
|||
self.global.clone()
|
||||
}
|
||||
|
||||
pub fn screen_inverted(&self) -> bool {
|
||||
self.screen_inverted
|
||||
}
|
||||
|
||||
pub fn set_screen_magnifier(&mut self, enabled: bool) {
|
||||
self.magnifier_state = enabled;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue