Mac system theme

Extension

Keeps interactive Pi sessions aligned with macOS light or dark appearance.

What it does

On interactive session start, this extension asks macOS for its dark-mode setting, selects Pi's dark or light theme, and repeats the check every two seconds.

It changes the theme only when the newly selected value differs, and it stops its polling timer during session shutdown.

When to reach for it

Invocation: Load the extension in Pi; session hooks run without a slash command.

Pi's interactive interface should follow macOS appearance
Let startup select the current light or dark theme automatically.
System appearance may change while a Pi session stays open
Use periodic checks to update Pi after the preference changes.

What it adds

  • An initial appearance check plus a two-second polling loop for interactive UI sessions.
  • Change detection, session-start reset, shutdown cleanup, and an unreferenced timer.

How it fits

  • Status line: Mac system theme selects Pi's palette; Status line separately uses the themed interface to display turn activity.

Common questions

What are its platform and failure limits?
  • It requires an interactive Pi UI and macOS System Events through osascript. A command error or any trimmed response other than true selects light.
  • Appearance changes are discovered by polling every two seconds, so updates are not event-driven.

It’s working if

  • An interactive session starts with Pi using the theme selected from the current macOS appearance response.
  • Changing macOS appearance causes Pi to switch after a later successful check, while an unchanged result does not call the theme setter again.

Source and setup

Provenance

Origin
Mario Zechner
Current maintainer
Vedang Manerikar
Relationship
adopted
Installed source
pi-extensions/mac-system-theme.ts
Source path
View source (pi-extensions/mac-system-theme.ts)
Compatibility
  • macOS
  • osascript
  • Interactive Pi UI
License
MIT
License publication scope
Independently written catalog summary plus source link and upstream attribution; retain MIT attribution.
Reviewed revision
9a0af933d90ad9175eca0ff27db6624c5d6bb4fe
Catalog revision
e0c035a297462c519315abfa1af31a1ed3bd9eef

Setup notes

  • Adopted from the MIT-licensed Pi example originally written by Mario Zechner; Vedang maintains this local copy.
  • The extension depends on macOS, osascript, and Pi's interactive theme API.
  • No polling starts when Pi reports no UI. The timer is cleared on shutdown and is unreferenced so it cannot keep the process alive by itself.