Add Xorg Remote controller capture with a core F11 escape

The Xorg command owner gains an exclusive Remote capture mode. Native
transitions pass through the repeat normalizer and capture router;
forwarded keys leave as remote.input events, Remote's own shortcuts are
dispatched locally, and F11 ends capture on the X thread. Reader policy,
overflow or inconsistent input also end it. Ending releases forwarded
keys first and keeps the grab until held keys are released. Local key
echo is suppressed during capture. The app attaches the owner to
sessions installed with keyboard-capture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chase CichorzandClaude Opus 5.5 committed 2026-11-06 16:06:38 -05:00
1 parent 2d5327adf4
commit c234cb82a8
18 files changed
+950 -11

No files matched your search

+6 -4
View File
@@ -38,7 +38,7 @@ func (owner *commandOwner) handleKey(key C.CommandKey) bool {
// Focus policy can change while the native owner waits for an X
// event. Replay a stale browse-only press against the requested
// policy, including custom symbols outside the default key list.
if !owner.learnMode && owner.uiSession == 0 && len(owner.held) == 0 && key.pressed != 0 && !owner.listener.browse.Load() && !owner.ocrReview &&
if !owner.learnMode && owner.uiSession == 0 && owner.remote == nil && len(owner.held) == 0 && key.pressed != 0 && !owner.listener.browse.Load() && !owner.ocrReview &&
!owner.router.IsModifier(uint32(key.symbol)) && owner.globalBindings[input.CommandChord{Symbol: uint32(key.symbol), Modifiers: uint16(key.modifiers)}] == "" {
owner.passThrough = true
}
@@ -48,7 +48,9 @@ func (owner *commandOwner) handleKey(key C.CommandKey) bool {
delete(owner.held, int(key.code))
}
owner.buffered = append(owner.buffered, key)
if owner.uiSession != 0 {
if owner.remote != nil {
owner.handle_remote_key(key)
} else if owner.uiSession != 0 {
if !owner.handle_internal_key(key) {
return false
}
@@ -157,7 +159,7 @@ func (owner *commandOwner) finishChord() bool {
owner.listener.failures <- fmt.Errorf("replay unbound X11 chord: native error %d", int(result))
return false
}
} else if !owner.learnMode && owner.uiSession == 0 {
} else if !owner.learnMode && owner.uiSession == 0 && owner.remote == nil {
C.release_command_keyboard(owner.device)
}
owner.router.Reset()
@@ -170,7 +172,7 @@ func (owner *commandOwner) finishChord() bool {
return false
}
}
owner.listener.grabActive.Store(owner.learnMode || owner.uiSession != 0)
owner.listener.grabActive.Store(owner.learnMode || owner.uiSession != 0 || owner.remote != nil)
owner.listener.uiEcho.Store(owner.uiSession != 0)
owner.listener.learnMode.Store(owner.learnMode)
owner.listener.learnEcho.Store(owner.learnMode)