Skip to content

feat(resolver): ✨ add X11 adapter implementations#18

Merged
justapithecus merged 1 commit intomainfrom
andrew/feat/resolver/x11
Feb 7, 2026
Merged

feat(resolver): ✨ add X11 adapter implementations#18
justapithecus merged 1 commit intomainfrom
andrew/feat/resolver/x11

Conversation

@justapithecus
Copy link
Member

Summary

Implement all three resolver sub-interfaces for X11, wrapping existing code from hotkey/x11.rs, hotkey/keybinding.rs, and hotkey/focus.rs. This is PR 2 of 4 in the resolver abstraction implementation.

Highlights

  • X11Shared — shared connection context created once via connect(), cloned into adapters via Arc
  • X11SessionResolver — focus detection via _NET_ACTIVE_WINDOW_NET_WM_PID → process tree walk; maps FocusError::NoSessionOk(None), FocusError::AmbiguousErr
  • X11HotkeyProviderXGrabKey registration with NumLock/CapsLock masking, spawns X11 event thread + classification bridge thread that emits HotkeyEvent on a channel
  • X11ClipboardProvider — synchronous xclip -selection clipboard for read/write
  • Makes hotkey/ submodule internals pub(crate) so adapters can reuse existing code without duplication

Test plan

  • cargo test — all 227 tests pass
  • cargo clippy --all-targets -- -Dwarnings — clean
  • cargo fmt --check — clean
  • Manual: adapters are not yet wired into the hotkey client (PR 3)

🤖 Generated with Claude Code

Base automatically changed from andrew/feat/resolver/traits to main February 7, 2026 21:15
Implement all three resolver sub-interfaces for X11:

- X11SessionResolver: focus detection via _NET_ACTIVE_WINDOW →
  _NET_WM_PID → process tree walk (wraps hotkey/x11.rs + hotkey/focus.rs)
- X11HotkeyProvider: XGrabKey registration, X11 event thread, and
  classification bridge that emits HotkeyEvent on a channel
- X11ClipboardProvider: xclip-based clipboard read/write

Shared X11 connection via X11Shared::connect() with Arc<RustConnection>.

Also makes hotkey submodule internals pub(crate) so resolver adapters
can reuse existing code:
- hotkey/mod.rs: focus, keybinding, x11 modules → pub(crate)
- hotkey/x11.rs: X11Context fields, Atoms, LOCK_MASK,
  detect_numlock_mask → pub(crate)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@justapithecus justapithecus force-pushed the andrew/feat/resolver/x11 branch from 8366784 to 80ebc65 Compare February 7, 2026 21:16
@justapithecus justapithecus merged commit d50f62f into main Feb 7, 2026
4 checks passed
@justapithecus justapithecus deleted the andrew/feat/resolver/x11 branch February 7, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant