Files
Relihan MyburghandEugene 649c4a32d6 Stop Touch Bar updates from freezing the app after long uptime (#11829)
* test(macos): show Touch Bar updates are sent on every tab title change

TouchbarService sends `window-set-touch-bar` on every tab title change, and
each message makes the main process replace every segment of the Touch Bar's
NSSegmentedControl. On macOS 26 that control is drawn with SwiftUI on every
Mac, Touch Bar or not, and each replacement leaves observation state behind
that makes the next one slower. After days of title updates the main process
freezes for seconds at a time.

The test changes a tab title 20 times a second for 2.5 seconds and expects
at most 3 updates; today it gets 50. It also expects a way to turn the
updates off. Both fail until the next commit.

Adds an `electron` stub (ipcRenderer records what is sent) and `Platform`
to the unit-test module hooks so the service can load under `node --test`.

* fix(macos): stop Touch Bar updates from freezing the app after long uptime

On macOS 26 the Touch Bar's NSSegmentedControl is drawn with SwiftUI, on
every Mac whether it has a Touch Bar or not. Each time its segments are
replaced it runs a layout pass whose observation state keeps growing, so the
pass gets slower with every update. Tabby replaced the segments on every tab
title change, and after a few days the main process spent seconds per update,
freezing input in every window.

- Send Touch Bar state at most once a second.
- In the main process, replace the segments only when they change; a tab
  switch now only moves the selection.
- Add hacks.disableTouchBar (Settings > Window > Disable Touch Bar) to skip
  creating the control at all.

* fixup

---------

Co-authored-by: Eugene <inbox@null.page>
2026-11-24 01:18:07 +01:00
..
2023-08-25 23:40:36 +02:00
2023-02-26 20:42:31 +01:00
2026-11-24 00:44:39 +01:00
2024-10-20 23:20:14 +02:00
2023-02-26 20:42:31 +01:00
2023-02-26 20:42:31 +01:00