fix: correct keylog defaults and keycode labeling#1
Conversation
Point the default capture paths at /realm/data/captures/keylog and fix evdev letter labeling so replay/reconstruction sees the actual key names. Also avoid appending Ctrl/Alt control-code text into the live buffer while preserving the raw key events for reconstruction.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When callers pass both --log-dir and --snapshot-dir, do not create the default data root just because --data-dir was omitted. This keeps CI and explicit test runs from trying to mkdir the workstation-only /realm path.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ff1f88f1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if (state->modifiers[MOD_CTRL] || state->modifiers[MOD_ALT]) { | ||
| /* Skip buffer append when Ctrl or Alt is held — xkbcommon returns | ||
| control codes (0x01-0x1f) that corrupt the buffer. The press event | ||
| still logs the keycode for reconstruction from raw events. */ | ||
| break; |
There was a problem hiding this comment.
Allow AltGr text entry in buffer updates
The new state->modifiers[MOD_ALT] guard skips all text appends whenever Alt is pressed, which regresses input on international layouts where Right Alt (AltGr) is required to produce normal characters (for example @, €, or locale-specific letters). In those sessions, keypresses are still logged but snapshots/buffer reconstruction lose actual typed text, so the captured output becomes incomplete for common user workflows outside US layouts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR updates scribe-tap’s default capture/log locations to match the current data-lake layout and fixes how evdev keycodes are labeled in press events so replay/reconstruction can correctly interpret letter keys.
Changes:
- Update default
data-dir/replay defaults and documentation from/realm/data/keylogto/realm/data/captures/keylog. - Fix
pressevent keycode labeling for A–Z by using an explicit evdev mapping instead of contiguous arithmetic. - Prevent Ctrl/Alt-modified XKB translations from being appended into the live buffer (but still log raw press events).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/replay.py | Updates default log/snapshot paths to the new captures/keylog location. |
| src/state.c | Fixes keycode labeling for letters; changes modifier handling during buffer reconstruction. |
| src/main.c | Updates the default --data-dir root path. |
| README.md | Updates documented defaults and replay examples to the new path. |
| AGENTS.md | Adds a generated-file notice and updates the documented default path. |
| .gitignore | Adds ignore rules for AGENTS files (but see comment re: tracked files). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else if (state->modifiers[MOD_CTRL] || state->modifiers[MOD_ALT]) { | ||
| /* Skip buffer append when Ctrl or Alt is held — xkbcommon returns | ||
| control codes (0x01-0x1f) that corrupt the buffer. The press event | ||
| still logs the keycode for reconstruction from raw events. */ | ||
| break; |
| } else if (state->modifiers[MOD_CTRL] || state->modifiers[MOD_ALT]) { | ||
| /* Skip buffer append when Ctrl or Alt is held — xkbcommon returns | ||
| control codes (0x01-0x1f) that corrupt the buffer. The press event | ||
| still logs the keycode for reconstruction from raw events. */ |
| { | ||
| char letter = lowercase_char_for_key(code); | ||
| if (letter >= 'a' && letter <= 'z') { | ||
| snprintf(buf, sizeof(buf), "KEY_%c", letter - 32); /* uppercase */ |
Summary
Correct scribe-tap's default keylog location and fix evdev keycode labeling for reconstruction/replay.
Problem
The project still documented and defaulted to /realm/data/keylog while the current data-lake location is /realm/data/captures/keylog. The installed keycode labeling also assumed KEY_A..KEY_Z were contiguous evdev codes, which broke recovered text reconstruction.
Solution
Point source/docs/replay defaults at /realm/data/captures/keylog, ignore generated agent files, and label keycodes through libevdev's key-name surface instead of contiguous letter arithmetic. Ctrl/Alt modified keypresses remain raw events without appending control-code text into the live buffer.
Verification
make check