PocketScope provides a lightweight, backend-agnostic screenshot facility so you can capture the current PPI (and overlays) without disrupting the frame loop. Images are written as PNG files.
All screenshots default to:
~/.pocketscope/screenshots/
The directory is created automatically (falls back to ./screenshots/ if the home path is not writable).
- Soft Key: A
Shotsoft key (when the bar is enabled) immediately saves a PNG and prints the path. - Keyboard: Press
F12in the desktop (pygame) window. - Signal: Send
SIGUSR1to the live viewer process (works well undersystemd). - Command File Drop: Create a file named
screenshot(any suffix accepted, e.g.screenshot123) inside:~/.pocketscope/commands/— the UI loop scans ~2× per second, deletes the file, and captures a screenshot. - API Call: Invoke
UiController.screenshot(path=None)directly from code. Provide apathstring to override the destination file name. - Deferred (Signal/File) Path:
UiController.request_screenshot()sets a flag so capture happens safely on the next frame boundary (used internally by signal + file triggers).
from pocketscope.ui.controllers import UiController
# ui: existing UiController instance
path = ui.screenshot() # returns '/home/user/.pocketscope/screenshots/pocketscope-YYYYMMDD-HHMMSS.png'
print("Saved", path)
# Deferred (signal-style) request
ui.request_screenshot() # will save on next frame; non-blockingsudo systemctl kill -s SIGUSR1 pocketscope.service
journalctl -u pocketscope.service -n 20 | grep screenshotmkdir -p ~/.pocketscope/commands
touch ~/.pocketscope/commands/screenshot_my_note
# Within ~0.5s a PNG will appear in ~/.pocketscope/screenshots- The operation is best-effort; backend failures are logged but non-fatal.
- The mechanism is safe for signal contexts (actual file I/O deferred to main loop).
- PNG contents reflect the fully rendered frame including overlays, labels, and vertical profile panel if active.
See tests/ui/test_screenshot.py for the stub display test ensuring UiController.screenshot() writes a PNG file and returns the path.
Screenshots naturally include any active theme; modify theme / themeOverrides in settings.yml to immediately change captured color palettes.
README.md(Theming & Palette, UI Controls)docs/theming.md(full palette key reference) *** End Patch