LR-BEHAV-ACCESS: Reduce Motion refuses a non-boolean on/follow; objc2-app-kit needs 0.3.2

view.reduceMotion reads on/follow through bool_param, so {on:"false"} no longer
toggles and a non-boolean follow no longer falls into the set branch. The safe
NSWorkspace calls need objc2-app-kit 0.3.2 (0.3.0/0.3.1 make them unsafe fn).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nathaniel LedfordandClaude Opus 5.5 committed 2026-11-02 15:53:55 -05:00
1 parent ab68806ea5
commit 6fa0b9b5a4
3 files changed
+22 -5

No files matched your search

+1 -1
View File
@@ -106,7 +106,7 @@ rfd = "0.17"
muda = { version = "0.21", default-features = false } # native menu bar (macOS: objc2/AppKit, pure Rust; no GTK)
# macOS: the profile of the screen showing the window (safe AppKit bindings; muda and wgpu use the same)
objc2 = { version = "0.6", default-features = false, features = ["std"] }
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSApplication", "NSAccessibility", "NSColorSpace", "NSResponder", "NSScreen", "NSWindow", "NSWorkspace"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSApplication", "NSAccessibility", "NSColorSpace", "NSResponder", "NSScreen", "NSWindow", "NSWorkspace"] }
objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSArray", "NSData"] }
# Linux: the desktop's dark/light setting from the XDG settings portal (Settings ▸ Interface ▸
# Appearance Mode ▸ Auto). Pure Rust; the version accesskit already brings in, pinned to it.
+4 -4
View File
@@ -351,11 +351,11 @@ fn ui_commands_2(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Val
"view.reduceMotion" => {
// {on?} sets it; {follow: true} goes back to the system's Reduce Motion; no params toggles
// what is in effect. Zoom and spinner animations stop; fades stay.
app.ui.settings.reduce_motion = if p.get("follow").and_then(Value::as_bool) == Some(true) {
None
} else {
Some(p.get("on").and_then(Value::as_bool).unwrap_or(!app.reduce_motion()))
let (follow, on) = match (bool_param(id, p, "follow"), bool_param(id, p, "on")) {
(Ok(follow), Ok(on)) => (follow, on),
(Err(e), _) | (_, Err(e)) => return Some(Err(e)),
};
app.ui.settings.reduce_motion = if follow == Some(true) { None } else { Some(on.unwrap_or(!app.reduce_motion())) };
Ok(json!({"on": app.reduce_motion(), "followsSystem": app.ui.settings.reduce_motion.is_none()}))
}
"view.faceBoxes" => {
+17
View File
@@ -104,6 +104,23 @@ fn the_command_toggles_and_sets_the_setting() {
assert_eq!(run(&mut h, "view.reduceMotion", json!({"on": false}))["on"], false);
}
#[test]
fn the_command_refuses_params_that_are_not_true_or_false_and_changes_nothing() {
let mut h = detail();
run(&mut h, "view.reduceMotion", json!({"on": true}));
for (params, says) in [
(json!({"on": "false"}), "`on` must be true or false"),
(json!({"on": 0}), "`on` must be true or false"),
(json!({"follow": "yes"}), "`follow` must be true or false"),
(json!({"follow": 1, "on": false}), "`follow` must be true or false"),
] {
let r = h.request("engine.execute", json!({"command": "view.reduceMotion", "params": params}), T);
assert_eq!(r["ok"], false, "{params}: {r}");
assert!(r.to_string().contains(says), "{params}: {r}");
assert_eq!(h.app.ui.settings.reduce_motion, Some(true), "{params} changed the setting");
}
}
#[test]
fn egui_easing_stops_with_reduce_motion_on_and_returns_when_off() {
let mut h = detail();