Files
hermes-agent/apps/desktop/src/lib/platform.ts
T
Brooklyn Nicholson 5851f9367c refactor(desktop): one mac check, one translucency atom
Three small dedupes in the surfaces this feature touches:

- GLASS_SUPPORTED was a fourth inline copy of "am I on a Mac" in the
  renderer. src/lib/platform.ts owns it now and the terminal's
  isMacPlatform re-exports it, so the two call sites can't drift.
- The store held intensity and mode as two atoms behind two localStorage
  keys with two subscriptions calling one sync. They are one setting: one
  atom, one key, one subscription. A pre-mode value under that key is a bare
  intensity, which has only ever meant clear -- read() keeps it there.
- global.d.ts re-declared the IPC payload as an inline union. It takes
  TranslucencyState, so widening the state can't leave the bridge behind.

isChatWindow is exported and takes its search string as a parameter, because
"which windows may thin their surfaces" is the contract worth pinning.
2026-08-18 00:57:01 -05:00

11 lines
420 B
TypeScript

/**
* Platform detection for the renderer.
*
* The renderer has no `process.platform`, and several surfaces need to know
* whether they're on a Mac — keybind glyphs, terminal shortcuts, and the
* macOS-only vibrancy features. One definition so they can't disagree.
*/
export const isMacPlatform = (): boolean =>
typeof navigator !== 'undefined' && /mac/i.test(navigator.platform || navigator.userAgent || '')