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

[Feature Request]: Better NSStatusItem NSAttributedString API #29313

Open
3 tasks done
sdegutis opened this issue May 24, 2021 · 2 comments
Open
3 tasks done

[Feature Request]: Better NSStatusItem NSAttributedString API #29313

sdegutis opened this issue May 24, 2021 · 2 comments

Comments

@sdegutis
Copy link

sdegutis commented May 24, 2021

Preflight Checklist

Problem Description

The only way to get a different font and/or colors are through two APIs, a string option for font, and ANSI color codes for color, which end up being buggy (see #29287 and #29288) and incompatible via these bugs.

Proposed Solution

Add a new API that lets me set the title via an array of objects with keys:

type CssCode = string;

type Segment = {
  text: string;
  bold?: boolean;
  fontName?: 'monospaced' | 'monospacedDigit';
  color?: CssCode;
};

class Tray {
  // ... existing methods

  setTitle(segments: (string | Segment)[]): void;
}

Something like that would easily map to NSAttributedString.

Alternatives Considered

None.

Additional Information

This would keep old setTitle() signature for backwards compatibility. It'd be a separate, new API.

@sdegutis
Copy link
Author

Oh also it should have a bold boolean key. Updating the thing now to include that.

@alectrocute
Copy link

fontSize too would be amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants