Skip to content

Claude/add screenshot feature xy dhv#6785

Open
jacobjeger wants to merge 16 commits into
Genymobile:masterfrom
jacobjeger:claude/add-screenshot-feature-xyDhv
Open

Claude/add screenshot feature xy dhv#6785
jacobjeger wants to merge 16 commits into
Genymobile:masterfrom
jacobjeger:claude/add-screenshot-feature-xyDhv

Conversation

@jacobjeger
Copy link
Copy Markdown

No description provided.

claude and others added 14 commits March 16, 2026 16:56
Save the current displayed frame as a PNG file to the current directory
with a timestamped filename (scrcpy_YYYYMMDD-HHMMSS.png). Uses FFmpeg's
PNG encoder with libswscale for YUV-to-RGB conversion, and applies the
current display orientation to match what's shown on screen.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
- White flash fades out over 300ms when screenshot is captured
- Fix filename buffer (64 -> 512) to fit ~/Downloads path
- Add LOGD debug logs throughout screenshot save flow
- Add flash state to display struct with timing via sc_tick

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
Opens adb logcat in Terminal.app on Mac, or x-terminal-emulator/xterm/
gnome-terminal on Linux.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
Queries the device for the currently resumed activity and opens
logcat filtered to that app's PID. Falls back to unfiltered logcat
if detection fails.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
Prints [DPAD] direction PRESS/RELEASE with repeat count to the
terminal, useful for debugging navigation in Android apps.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
After each D-pad key release, asynchronously queries the device
for the currently focused view/window and logs it as [FOCUS].
Helps debug how the app responds to D-pad navigation.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
Uses uiautomator to query which view has focus after each D-pad
key release. Logs the resource ID, class name, text content, and
bounds of the focused element, e.g.:

  [FOCUS] com.app:id/settings_btn (Button) text="Settings" [0,100][200,150]

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
…tails

Now logs:
- Focus transitions: "Focus moved: btn_alarm (Button) -> btn_settings (Button)"
- Focused window/activity name
- Element details: bounds, package, content-desc, selected/enabled/clickable/scrollable
- Direction context: "[DPAD RIGHT] Focus moved: ..."
- Previous vs current focus comparison to detect unchanged focus

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
…cking

uiautomator dump was unreliable - it never found focused elements in many
apps. Switch to parsing the View Hierarchy from dumpsys activity top, which
marks the focused view with a leading asterisk (*). Also removed unused
XML parsing helpers.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
dumpsys activity top wasn't finding focused views either. The app already
logs focus state via logcat with tag DPAD (e.g. "focus=MaterialButton(id=preset3m)").
Now we read that directly with "adb logcat -d -s DPAD:D" which is the most
accurate source since it comes from the app's own focus handling.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
The previous approach used `adb logcat -d -s DPAD:D` which only worked
if the foreground app logged focus info with a custom "DPAD" tag. Most
apps (including the launcher) don't do this, causing "No focus info
found in app logcat" warnings on every DPAD press.

Now uses `dumpsys activity top` to query the actual focused view from
the system, which works universally with any app. Falls back to
`dumpsys window windows` if no view-level focus is found.

https://claude.ai/code/session_013cas8E79mZumBkkCngSPsC
Reserves a 72-px strip at the top of the scrcpy window and draws four
square buttons in the top-right corner, each with a tiny icon and a
3-letter text label rendered from an embedded 5x7 bitmap font:

  [SYS] full system log dump (adb logcat -d -b all)
  [APP] foreground-app log dump (adb logcat -d --pid=...)
  [LOG] open live logcat in Terminal (same as Ctrl+Shift+L)
  [CAM] screenshot to ~/Downloads + auto-copy PNG to clipboard

Click the buttons to trigger the actions. All sizing/resize logic in
screen.c is taught about the toolbar so the mirrored content stays
correctly centered below it. Mouse events over the toolbar strip are
swallowed so they never reach the device.

Screenshot saves now also copy the PNG to the system clipboard
(osascript on macOS, xclip/wl-copy on Linux) so images can be pasted
straight into Slack/Messages/etc.

README documents the Dock-shortcut setup for macOS.
jacobjeger and others added 2 commits April 24, 2026 17:25
A fifth labelled button on the leftmost end of the toolbar. Clicking it
sends the Android HOME keycode (down + up) via the existing action_home
path, so it behaves identically to pressing the device's home button or
the Ctrl+H keyboard shortcut.

Icon: a small house drawn from rect primitives (peaked roof + body
with a door cutout). Label: "HOME" (added H and E to the embedded
mini font).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants