Skip to content

Read the window title only for script transformations - #844

Open
rekram1-node wants to merge 2 commits into
devfrom
window-title-on-demand
Open

rekram1-node wants to merge 2 commits into
devfrom
window-title-on-demand

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On macOS, Hex reads the front window's title through Accessibility every 500 ms, for everyone. Titles often hold email subjects, document names, chat names and page titles. Within dictation, only script transformations ever see the title (windowTitle in their context), so for nearly everyone it's read for nothing.

Every title change also counts as a context change. So each one writes a context line to live.ndjson, which is never trimmed: switching a Slack channel or a browser tab adds a line. One real log had 7,620 of these. After #777 they only name the app, so most are the same "Slack" line over and over.

Change

 every 500 ms
   front app (NSWorkspace)
   page, if a website mode / rewrite / script uses it   (#777)
-  window title (Accessibility)
+  window title, only if a script transformation is set up
   changed -> listener
-    log { application }
+    app switched? -> log { application }
  • dictation::config::reads_window_title() is true when any mode uses a transformation that isn't built in. It's set alongside reads_browser() whenever settings apply, so it takes effect without a restart.
  • Meeting detection's fallback still reads the title, since detection uses it to spot calls.
  • Every context change still marks input activity, which decides whether the next paste continues the previous one (leading space, lowercase first letter). Without a script, a title change is no longer a context change. So two dictations in different windows of the same app, with no key or click between them (say, a trackpad swipe between full-screen windows), now join. The other side of it: title changes caused by the paste itself (TextEdit's "Edited", unread counts) no longer break a real continuation. App switches, keys and clicks still reset it.
  • The debug dashboard reads the current app from EventReader::current_context, so it doesn't lose it now that context lines are rarer.
  • uses_browser now also counts browser_hosts on the Global mode, which is normally empty.

Out of scope

  • live.ndjson still has no size limit, and existing lines stay.

Verification

  • cargo fmt --all --check and scripts/code-shape.py --check pass.
  • I couldn't build locally (this Mac has only the Command Line Tools, so the Swift bridges don't compile). CI covers the build, clippy, and the extended browsers_are_asked_only_when_something_uses_the_page test.
  • Not run on a real Mac.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant