Adem Gökhan Tüfekci

2026

Contributing to Dikte

Dikte is an open-source speech-to-text app written by yusufipk — it is not mine. I sent a contribution that finds and fixes the focus bug which dropped the transcript into the wrong window on macOS.

Open-source contributionDebuggingmacOS

Whose project this is

Dikte was written by yusufipk: an open-source, GPL-3.0 licensed, Linux-first speech-to-text application. The app itself is not mine; my share here is a single contribution, and this page is about that contribution.

The problem

On macOS every dictation took the front away from the window the text was meant for. Press the shortcut in a text editor and the editor goes inactive: the caret stops, the title bar greys out, and the paste at the end of the run lands somewhere other than the document. Clicking back into the window before the transcript arrived was the only way to get the text where it belonged.

Found by measurement, not by guessing

The first suspect was the indicator window shown during recording; it was not that. Recording goes through ffmpeg’s avfoundation input, and opening a capture session there brings the process that did it to the front. ffmpeg is a child of Dikte with no bundle of its own, so the system credits the move to Dikte. I compared logging from inside the process against `lsappinfo front` outside it, on one clock: at the keypress the front is still the editor, when the start call returns it is still the editor, and 89 milliseconds later it is Dikte. That gap is what made the bug look like the indicator.

Two things that did not work

Worth writing down so nobody else spends the afternoon on them: starting ffmpeg in its own session made no difference, and clearing the bundle identifier from the child’s environment made no difference either. A capture session is not a window, so no flag reaches its activation behaviour.

The fix

Before recording starts — and before the indicator is shown — the app notes which window is in front, and gives the front back the moment Dikte takes it. Measured at 99 milliseconds from the moment the front is taken, against a title bar that stayed grey for the whole dictation before. If the user moved to another window themselves in the meantime, that is where they want the text, so it is left alone. A second check runs immediately before the keystroke that pastes.

Tests

I wrote 52 new tests, none of them skipped. The macOS-only interfaces load at call time rather than at import, so the code imports on a machine with no AppKit and a Linux CI run exercises every line of it. The project went from 1081 tests to 1133, both green.

Status

Opened on 16 August 2026 and still awaiting review — not merged yet. Whether it is accepted is the maintainer’s call.