This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Wayshot is a screen recording tool for Linux Wayland systems using the wlroots extension protocol. It's built with Rust and the Slint GUI framework, supporting single screen recording, audio recording from input devices and desktop, and microphone noise reduction. The project uses a workspace structure with multiple libraries.
make desktop-debug- Run desktop application in debug mode (with RUST_LOG=debug)make desktop-debug-winit- Run with winit backend for better font rendering on Linuxmake android-debug- Run on Android device/emulatormake web-debug- Build and serve web version locally
make desktop-build-release- Build desktop release binarymake android-build-release- Build Android APKmake web-build-release- Build web distribution
make test- Run all tests in the workspace with outputcargo test -p recorder- Run tests for just the recorder librarycargo test --workspace --all-features- Run all tests with all featuresmake clippy- Run clippy linter on workspacemake check- Run cargo check on workspace
- Run recorder examples:
cargo run --example recording_5s_demo -p recorder make tr- Run translation helper toolmake icon- Generate icons from imagesmake slint-viewer-desktop/android/web- Preview UI files with auto-reload
wayshot/- Main application crate with Slint GUIlib/recorder/- Core screen recording library (this directory)lib/screen-capture/- Screen capture abstraction layerlib/screen-capture-wayland-wlr/- Wayland-specific screen capture implementationlib/mp4m/- MP4 processing and manipulationlib/cutil/- Utility library (crypto, filesystem, time, strings, etc.)lib/sqldb/- SQL database abstractionlib/pmacro/- Procedural macrostr-helper/- Translation helper toolicon-helper/- Icon generation tool
The recorder library provides the core screen recording functionality:
Key Components:
RecordingSession- Main recording orchestratorAudioRecorder- Audio input device recordingSpeakerRecorder- Desktop/system audio recordingVideoEncoder- Video encoding using x264CursorTracker- Mouse cursor position trackingRecorderConfig- Configuration builder for recording sessions
Key Features:
- Multi-threaded video/audio capture and encoding
- Real-time audio level monitoring
- Noise reduction support (using nnnoiseless)
- Various FPS options and video resolutions
- Cursor tracking integration
- Cross-platform screen capture abstraction
Testing Examples:
recording_5s_demo.rs- Basic 5-second recording demorecording_10m_demo.rs- Longer recording testaudio_recording_demo.rs- Audio-only recording testcursor_tracking_*_demo.rs- Cursor tracking functionality tests
- Desktop: Uses
desktop-wayland-wlrfeature for Wayland support - Android: Uses
mobilefeature with Android-specific dependencies - Web: Uses
webfeature with WASM compilation
wayland-wlr- Wayland wlr-protocols support (default)
- Linux Wayland: Requires
libpipewireandlibalsafor audio capture - FFmpeg: Required for final MP4 file processing
- Rust: Uses 2024 edition with workspace dependencies
- Uses CPAL for cross-platform audio input
- PipeWire for Linux system/desktop audio capture
- Supports mono conversion and noise reduction
- Real-time audio level monitoring through channels
- x264 encoding via x264-rust bindings
- Fast image resize with rayon parallelization
- YUV color space handling
- Frame buffering and FPS control
- For recorder development:
cargo test -p recorder -- --nocapture - For GUI changes:
make slint-viewer-desktopfor live preview - For integration testing:
make testto run all workspace tests - Examples are in
lib/recorder/examples/for testing specific functionality
- 不要使用模拟数据
- 不要使用 plachoder 或模拟数据