Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use foreground color in macOS tab titles #3843

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BlakeWilliams
Copy link

I'm not a Zig or a Swift/macOS developer but I've been really liking GhostTTY and wanted to open this PR to either contribute back, or at least share the progress/learnings when tackling #2764 (which I think this should close, if this is a valid approach). I have a vimscript that syncs the terminal colors with my vim theme, so I was pretty motivated to implement this feature.

This change was relatively straightforward (but required a lot of learning). In general it:

  • Tracks foregroundColor in the SurfaceView. It's pre-populated with the config defined foreground color. It is also updated via the color change events (which I added foreground support to)
  • Adds a new titleForegroundColor property to use in TerminalWindow titles so the colors can be updated dynamically.
  • Updates each window's tab foreground color when syncAppearance is called. (I'm honestly not sure if this is the best approach, but it's the solution I found. happy to update if there's a better approach)
  • Calls syncAppearance when a window becomes the key window to sync the colors across each tab.
  • Updates some fonts to use 11pt sizes instead of systemFontSize to match the existing behavior/size of tabs (happy to provide screenshots to elaborate)

Here's a quick screencap of the new behavior:

Kapture.2024-12-28.at.21.49.46.mp4
I also quickly validated that this works with `macos-titlebar-style=transparent` in addition to `tabs` Screenshot 2024-12-28 at 10 01 24 PM
and just for completions sake, bg transparency: Screenshot 2024-12-28 at 10 04 20 PM

Currently tab titles will use the default macOS tab foreground color,
but the color schemes background color. This can result in tabs with
unreadable text.

This change updates the macOS UI tabs to use the foreground color
defined in the config, or the overridden value when set dynamically.

This change:

- Tracks `foregroundColor` in the SurfaceView which is pre-populated
  with the config foreground color along with support for color change
  update events.
- Adds a new `titleForegroundColor` property to use in `TerminalWindow`
  titles.
- Updates each tab window foreground color when `syncAppearance` is
  called.
- Calls `syncAppearance` when a window becomes the key window.
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