Skip to content

macOS: show "Tao GUI" in the menu bar instead of python3.x - #17

Merged
DavidSagan merged 1 commit into
mainfrom
macos-app-name
Nov 7, 2026
Merged

DavidSagan merged 1 commit into
mainfrom
macos-app-name

Conversation

@DavidSagan

@DavidSagan DavidSagan commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

On macOS the menu bar showed the Python interpreter's name, such as "python3.15", for the application.

macOS takes that name from the main bundle's CFBundleName. A Python script has no app bundle, so the interpreter's name is shown. tao-gui now sets CFBundleName (and CFBundleDisplayName) to Tao GUI before the QApplication is created, so the Cocoa app picks it up.

  • No new dependency: new module tao_gui/macos.py makes the calls into the Objective-C runtime through ctypes, not PyObjC.
  • Safe: errors are ignored, since the name is cosmetic. Off macOS it does nothing.

Checked on the real Cocoa platform (not offscreen)

Python Before After
Framework Python with a bundle (python.org/Homebrew venv) app name and menu title "Python" "Tao GUI" for both
Python without a bundle (conda, like the one showing "python3.15") menu title from the script/interpreter menu title "Tao GUI"

Not changed for a Python without a bundle: the process name macOS shows in Cmd-Tab and the Dock (NSRunningApplication.localizedName) stays "python". Changing that would need a real .app bundle.

Testing

  • 47 tests pass and 1 is skipped, locally and against the conda-forge Tao used in CI. 2 are new, in tests/test_macos.py: the name is set and read back on macOS (the other, for non-macOS systems, is skipped here and runs on the ubuntu CI job).

🤖 Generated with Claude Code

macOS takes the menu-bar name from the main bundle's CFBundleName, which
for a plain Python is the interpreter. Set it (via ctypes calls into the
Objective-C runtime, no new dependency) before the QApplication is
created. Failures are ignored; off macOS it does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidSagan
DavidSagan merged commit d0c4a7e into main Nov 7, 2026
2 checks passed
@DavidSagan
DavidSagan deleted the macos-app-name branch November 7, 2026 07:07
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