Skip to content

feat(macos): configure native horizontal scrolling - #731

Open
cromulus wants to merge 1 commit into
AprilNEA:masterfrom
cromulus:feat/native-horizontal-scroll
Open

feat(macos): configure native horizontal scrolling#731
cromulus wants to merge 1 commit into
AprilNEA:masterfrom
cromulus:feat/native-horizontal-scroll

Conversation

@cromulus

Copy link
Copy Markdown

Summary

  • Add per-device controls for native horizontal-scroll speed and direction on macOS.
  • Adjust incoming horizontal CGEvent deltas in place so applications retain the original scroll phases, momentum metadata, and event source.
  • Keep trackpads, unrecognized sources, receiver-routed devices, and ambiguous same-model devices unchanged.

Changes

  • openlogi-core: bump the config schema to v5 and add validated horizontal_scroll_sensitivity and invert_horizontal_scroll device settings. The 20–100 sensitivity range maps to 1×–5× native movement.
  • openlogi-hook: include scroll-wheel events in the macOS event tap and scale Axis 2 across line, fixed-point, and point/pixel delta fields.
  • openlogi-agent-core: publish direct-device VID/PID adjustment maps and fail closed when device attribution is unavailable or ambiguous.
  • openlogi-desktop / openlogi-ui: expose localized horizontal speed and inversion controls in Pointer → Scrolling and keep the scrolling card reachable at smaller window heights.
  • docs: document the TOML keys, defaults, range, and macOS attribution limits.

Related work

Testing

  • asdf exec cargo fmt --all -- --check
  • asdf exec cargo clippy --workspace --all-targets -- -D warnings
  • ASDF_RUST_VERSION=1.98.0 asdf exec cargo test --workspace
  • RUSTDOCFLAGS="-D warnings" ASDF_RUST_VERSION=1.98.0 asdf exec cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent
  • Runtime-tested on macOS with an MX Anywhere 2 connected over Bluetooth using a production bundle: inversion and sensitivity changes apply immediately.
  • Linux and Windows runtime paths are unchanged; the cfg-gated macOS changes were hand-audited against current master.

Related to #100, #357, and #359.

@cromulus
cromulus requested a review from AprilNEA as a code owner August 20, 2026 19:58
@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown

Greptile Summary

Adds configurable native horizontal-scroll speed and inversion for directly connected macOS devices while preserving the original CGEvent stream.

  • Extends the per-device configuration schema and desktop controls.
  • Attributes horizontal events by direct-device VID/PID and publishes signed scaling policies to the hook.
  • Mutates all macOS Axis 2 delta representations in place while excluding trackpads, receivers, and unknown sources.
  • The UI does not account for ambiguous identical direct devices even though the runtime rejects conflicting policies.

Confidence Score: 4/5

The identical-direct-device attribution mismatch should be fixed before merging because the UI can confirm settings that the runtime silently discards.

Two same-model direct mice are presented as independently supported, but differing per-device settings collapse to no runtime adjustment when the agent groups them by VID/PID.

Files Needing Attention: crates/openlogi-desktop/src/state/scroll.rs, crates/openlogi-desktop/src/app/detail.rs, crates/openlogi-agent-core/src/orchestrator.rs

Important Files Changed

Filename Overview
crates/openlogi-agent-core/src/orchestrator.rs Builds VID/PID adjustment maps and intentionally drops conflicting policies for indistinguishable direct devices.
crates/openlogi-agent-core/src/hook_runtime.rs Selects eligible native horizontal events and returns the macOS adjustment disposition without blocking the event tap.
crates/openlogi-hook/src/macos.rs Adds scroll-wheel capture and scales all horizontal CGEvent delta representations in place.
crates/openlogi-core/src/config/settings.rs Defines the validated 20–100 horizontal sensitivity domain and its 100–500 percent mapping.
crates/openlogi-desktop/src/state/scroll.rs Persists the new controls but incorrectly reports every persistent direct device as independently supported.
crates/openlogi-desktop/src/app/detail.rs Renders enabled macOS horizontal-scroll controls without communicating same-VID/PID ambiguity.

Sequence Diagram

sequenceDiagram
  participant User
  participant UI as Desktop UI
  participant Config
  participant Agent as Agent Orchestrator
  participant Hook as macOS Event Tap
  participant App as Target Application
  User->>UI: Select speed / inversion
  UI->>Config: Persist per-device setting
  UI->>Agent: Reload configuration
  Agent->>Agent: Group direct devices by VID/PID
  Agent->>Hook: Publish signed scale map
  Hook->>Hook: Attribute horizontal CGEvent
  Hook->>Hook: Scale Axis 2 line/fixed/point fields
  Hook->>App: Pass through mutated original event
Loading

Fix all with Greploop Fix All in Codex Fix All in Claude Code

Reviews (1): Last reviewed commit: "feat(macos): configure native horizontal..." | Re-trigger Greptile

Comment on lines +71 to +76
pub fn current_horizontal_scroll_supported(&self) -> bool {
cfg!(target_os = "macos")
&& self.current_record().is_some_and(|record| {
record.persistent_config_key().is_some()
&& matches!(record.route, Some(DeviceRoute::Direct { .. }))
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Duplicate devices report false support

When two directly connected mice share a VID/PID and have different horizontal-scroll settings, this predicate reports both as independently supported, but the agent removes their conflicting shared map entry. The UI therefore displays the selected speed or inversion as active while both mice continue using native horizontal scrolling.

Knowledge Base Used:

Fix in Codex Fix in Claude Code

@davidbudnick

davidbudnick commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@cromulus I approved you job running can you please fix the comments from greptile-apps and the pipeline?

@davidbudnick davidbudnick added platform: macos macOS-specific issue type: bug Something is broken or behaves incorrectly labels Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: macos macOS-specific issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants