Frayo

← All posts

Copy code straight out of a video call

Drag over code on a shared screen. Paste it, indented, into your editor.

Someone shares their screen and says "just use this snippet". The snippet is on a slide, in a stream or in a recording. You cannot select it. You squint, retype it, and miss a brace.

Normal text recognition makes it only a little better. It reads the words and loses the layout. You get code with every line flush left, which in Python is no code at all.

Copy Text, but it knows about code

Press ⌥⇧2 and drag over the code. Frayo reads it on your Mac, then looks at where each line sits.

The result goes to your clipboard. A message says how many lines, with a button: Copy as Code Block. That copies the same code fenced in triple backticks and tagged with a guessed language (Swift, Python, JavaScript, Go, Rust, Java, JSON, Bash or SQL), ready for a chat or a pull request.

How it knows it is code

It does not ask you. It looks for the signs: lots of { } ( ) ; =, lines ending in ; or {, keywords like def and import, and indented lines. With two or more signs it treats the text as code. Otherwise you get plain lines, as before.

It is a guess

We want to be straight about this.

Always run it, or at least read it, before you trust it. It saves you the retyping, not the review.

Everything stays on your Mac

The image is read with the Vision framework in macOS. Nothing is uploaded, and the image is thrown away as soon as the text is read.

Two more things

Once you have the code, Tools → Code Screenshot from Clipboard turns it into a clean image with a theme, line numbers and a window frame, for a slide or a post.

And if you want the text from a file or a script, frayo ocr shot.png --code does the same from the command line.

Coming soon