Imported from CynepHy6/pshooter (
AGENTS.md). Install upstream withnpx skills add CynepHy6/pshooter. Copyright stays with the author.
pshooter
Tauri 2 tray screenshot utility. Frontend: vanilla JS (no bundler). Backend: Rust 2021. Package manager: npm (package-lock.json). Windows-first; Linux/macOS via cfg.
Commands
npm install
npm run dev
npm run build
Cursor Agent / sandbox builds — required before any tauri/cargo compile:
Remove-Item Env:CARGO_TARGET_DIR -ErrorAction SilentlyContinue
$env:CARGO_TARGET_DIR = Join-Path "<repo-root>" "src-tauri\target"
If $env:CARGO_TARGET_DIR contains cursor-sandbox-cache, override it first. Artifacts must land in src-tauri/target/, not Temp.
Before rebuild, stop a running binary if the linker fails with access denied:
Get-Process pshooter -ErrorAction SilentlyContinue | Stop-Process -Force
No test/lint suite yet. Do not invent CI commands.
Architecture
| Path | Role |
|---|---|
src/ |
Settings UI (index.html, main.js, styles.css); uses window.__TAURI__ (withGlobalTauri) |
src-tauri/src/lib.rs |
App entry: tray, commands, window close → hide |
src-tauri/src/capture.rs |
Screenshot save (fullscreen / active window) |
src-tauri/src/hotkeys.rs |
Global PrintScreen hooks (Windows: WH_KEYBOARD_LL) |
src-tauri/src/focus.rs |
Foreground HWND / PID / process name |
src-tauri/src/config.rs |
config.json load/save, path helpers |
src-tauri/capabilities/ |
Tauri ACL permissions |
src-tauri/tauri.conf.json |
Window + bundle config; frontendDist: ../src |
Rules:
- Keep OS-specific code behind
#[cfg(windows)]/#[cfg(not(windows))]. - Persist settings via
config.rs→%APPDATA%/pshooter/config.json(or platformdirs::config_dir). - Default save dir:
Pictures/pshooter. Window shots go under<save_dir>/<process_stem>/. - Closing the main window must hide to tray; quit only from tray menu.
Code Style
- UI copy is Russian.
- Do not delete commented-out code unless the user asks.
- Prefer small modules over growing
lib.rs. - Match existing patterns:
parking_lot::Mutex,Arc<AppState>, Tauri commands returningResult<_, String>.
Known bugs
- Cannot screenshot itself. Capturing the pshooter settings window (own WebView2 process) fails: window/button capture and PrintScreen while focused on pshooter do not save a usable shot. Other apps (Explorer, browsers, games) work. Treat as known; do not churn large capture/hotkey rewrites unless the user asks to fix this specifically.
- PrintScreen interception can race with Windows Snipping Tool / OneDrive. Prefer minimal, testable changes if touching hooks.
Boundaries
- Never commit
node_modules/,src-tauri/target/,src-tauri/gen/schemas, secrets, or userconfig.json. - Never force-push / rewrite git history unless asked.
- Ask first before: changing identifier/
productName, adding a frontend bundler (Vite/React), or dropping WindowsWH_KEYBOARD_LLfor another input stack.
Git
- Remote:
git@github.com:CynepHy6/pshooter.git(SSH). - Initial history uses short descriptive commits; keep messages focused on why.