Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 4.05 KB

README.md

File metadata and controls

86 lines (69 loc) · 4.05 KB

Scribble for Windows and Linux

The port of the macOS app. What it does and how to install it is in the main README; how it relates to the macOS app is in SPEC.md §11. This file is for working on it.

Layout

src/scribble/
  core/          models, geometry, keyframe selection, markdown, languages: a port of
                 ScribbleCore, no Qt and no I/O (chunks.py, cutting long audio, is its own)
  render.py      annotations with QPainter (live overlay and saved frames share it)
  video.py       PyAV: recording, frame extraction, audio files, mux
  audio.py       microphone → 16 kHz mono on the session clock
  transcriber.py faster-whisper, model download, CUDA probe
  live.py        transcribes a recording while it runs
  processor.py   a finished capture → frames, capture.md, events.json
  screens.py     displays, screen grabbing (mss; the desktop's tools on Wayland)
  recorder.py    one thread per display: grab, encode, thumbnail
  session.py     SessionController: the capture state machine
  platform/      what Qt does not cover: hotkeys, input state, click-through, focus, autostart
                 (windows.py: ctypes, x11.py: python-xlib)
  ui/            canvas, overlays, capture toolbar and toasts, tray, windows
  sounds.py      start/stop/done cues, played by the system
  ipc.py         single instance and the command line triggers
  app.py, cli.py entry point and developer commands
packaging/       PyInstaller spec, build script and a smoke test for the built app

Run and test

pip install -e ".[dev]"
python -m scribble            # the app, from source
python -m scribble --help     # triggers and developer commands
pytest                              # everything that needs no display

pytest covers the core (the Swift tests, ported), parity with the macOS app's output, the pipeline on synthetic recordings, and the capture state machine driven through the real overlays with a fake screen and microphone.

Two more suites are opt-in:

# Real Whisper models (tiny.en, ~75 MB, and base, ~145 MB) on a recording of the sentence
# in tests/test_model.py; SCRIBBLE_SPEECH_DE=german.wav adds a test with German speech
SCRIBBLE_TEST_MODEL=1 SCRIBBLE_SPEECH=speech.wav pytest -m model

# A real desktop session, driven with synthetic mouse and keyboard input
pytest --desktop tests/integration          # Windows
tests/integration/run_x11.sh                # Linux: Xvfb + openbox (COMPOSITOR=1 adds picom)

The desktop tests move the pointer, press keys and open windows: run them in a VM or under Xvfb, not in the session you are working in. CI (.github/workflows/desktop.yml) runs all three suites on Windows and Ubuntu and uploads screenshots of what was on screen.

Several displays: tests/test_multi_display.py runs the capture flows on two emulated displays, the second at 200% (Qt's offscreen platform can be given a screen layout). Display scaling on a real session: SCREEN=2880x1620x24 QT_SCALE_FACTOR=1.5 tests/integration/run_x11.sh is a 1920×1080 desktop at 150%.

Self-contained build

For people without Python: a folder with everything in it, made with PyInstaller.

pip install -e . pyinstaller
python packaging/build.py                                  # → dist/scribble/ and an archive
python packaging/smoke_test.py dist/scribble speech.wav

It has two launchers over the same files: scribble (the app, no console window) and scribble-cli (the triggers and developer commands, with output). The smoke test runs the commands, the whole Snapshot pipeline on a speech recording, and starts and quits the app. CI builds and tries it on Windows and Linux and keeps the archives as artifacts.

Debugging

  • Log: ~/.scribble/scribble.log (and stderr).
  • SCRIBBLE_HOME=/some/folder moves settings, models and captures (tests use it).
  • SCRIBBLE_WATCHDOG=30 writes every thread's stack to stderr every 30 seconds; on Linux kill -USR1 <pid> does it once.
  • scribble --list-displays prints the displays, their scaling and the backend in use.